jspg masking system installed
This commit is contained in:
171
tests/fixtures/masking.json
vendored
Normal file
171
tests/fixtures/masking.json
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
[
|
||||
{
|
||||
"description": "Masking Properties",
|
||||
"schema": {
|
||||
"$id": "mask_properties",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"foo": {
|
||||
"type": "string"
|
||||
},
|
||||
"bar": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"foo"
|
||||
],
|
||||
"extensible": false
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "Keep valid properties",
|
||||
"data": {
|
||||
"foo": "a",
|
||||
"bar": 1
|
||||
},
|
||||
"valid": true,
|
||||
"expected": {
|
||||
"foo": "a",
|
||||
"bar": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Remove unknown properties",
|
||||
"data": {
|
||||
"foo": "a",
|
||||
"baz": true
|
||||
},
|
||||
"valid": true,
|
||||
"expected": {
|
||||
"foo": "a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Keep valid properties with unknown",
|
||||
"data": {
|
||||
"foo": "a",
|
||||
"bar": 1,
|
||||
"baz": true
|
||||
},
|
||||
"valid": true,
|
||||
"expected": {
|
||||
"foo": "a",
|
||||
"bar": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Masking Nested Objects",
|
||||
"schema": {
|
||||
"$id": "mask_nested",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"meta": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"extensible": false
|
||||
}
|
||||
},
|
||||
"extensible": false
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "Mask nested object",
|
||||
"data": {
|
||||
"meta": {
|
||||
"id": 1,
|
||||
"extra": "x"
|
||||
},
|
||||
"top_extra": "y"
|
||||
},
|
||||
"valid": true,
|
||||
"expected": {
|
||||
"meta": {
|
||||
"id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Masking Arrays",
|
||||
"schema": {
|
||||
"$id": "mask_arrays",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extensible": false
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "Arrays are kept (items are valid)",
|
||||
"data": {
|
||||
"tags": [
|
||||
"a",
|
||||
"b"
|
||||
]
|
||||
},
|
||||
"valid": true,
|
||||
"expected": {
|
||||
"tags": [
|
||||
"a",
|
||||
"b"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Masking Tuple Arrays (prefixItems)",
|
||||
"schema": {
|
||||
"$id": "mask_tuple",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"coord": {
|
||||
"type": "array",
|
||||
"prefixItems": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"extensible": false
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "Extra tuple items removed",
|
||||
"data": {
|
||||
"coord": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
"extra"
|
||||
]
|
||||
},
|
||||
"valid": true,
|
||||
"expected": {
|
||||
"coord": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -1098,6 +1098,30 @@ fn test_pattern_1() {
|
||||
util::run_test_file_at_index(&path, 1).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_masking_0() {
|
||||
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
|
||||
util::run_test_file_at_index(&path, 0).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_masking_1() {
|
||||
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
|
||||
util::run_test_file_at_index(&path, 1).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_masking_2() {
|
||||
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
|
||||
util::run_test_file_at_index(&path, 2).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_masking_3() {
|
||||
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
|
||||
util::run_test_file_at_index(&path, 3).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_max_properties_0() {
|
||||
let path = format!("{}/tests/fixtures/maxProperties.json", env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
Reference in New Issue
Block a user