Skip to content

Commit 9319344

Browse files
committed
Test cases for propertyNames with pattern - update after PR feedback.
1 parent 8e4aad9 commit 9319344

File tree

3 files changed

+21
-111
lines changed

3 files changed

+21
-111
lines changed

tests/draft2019-09/propertyNames.json

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,59 +46,29 @@
4646
{
4747
"description": "propertyNames validation with pattern for camelCase",
4848
"schema": {
49-
"propertyNames": { "pattern": "^[a-z]+([A-Z][a-z]+)*$" }
49+
"propertyNames": { "pattern": "^a+$" }
5050
},
5151
"tests": [
5252
{
53-
"description": "all property names valid",
53+
"description": "matching property names valid",
5454
"data": {
55-
"f": {},
56-
"foo": {},
57-
"foobar": {},
58-
"fooBar": {}
55+
"a": {},
56+
"aa": {},
57+
"aaa": {}
5958
},
6059
"valid": true
6160
},
6261
{
63-
"description": "property name with leading capital letter is invalid",
64-
"data": {
65-
"Foo": {}
66-
},
67-
"valid": false
68-
},
69-
{
70-
"description": "property name with adjacent capital letters is invalid",
62+
"description": "non-matching property name is invalid",
7163
"data": {
72-
"fOO": {}
73-
},
74-
"valid": false
75-
},
76-
{
77-
"description": "property name with digit is invalid",
78-
"data": {
79-
"foo1": {}
64+
"aaA": {}
8065
},
8166
"valid": false
8267
},
8368
{
8469
"description": "object without properties is valid",
8570
"data": {},
8671
"valid": true
87-
},
88-
{
89-
"description": "ignores arrays",
90-
"data": [1, 2, 3, 4],
91-
"valid": true
92-
},
93-
{
94-
"description": "ignores strings",
95-
"data": "foobar",
96-
"valid": true
97-
},
98-
{
99-
"description": "ignores other non-objects",
100-
"data": 12,
101-
"valid": true
10272
}
10373
]
10474
},

tests/draft6/propertyNames.json

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,59 +46,29 @@
4646
{
4747
"description": "propertyNames validation with pattern for camelCase",
4848
"schema": {
49-
"propertyNames": { "pattern": "^[a-z]+([A-Z][a-z]+)*$" }
49+
"propertyNames": { "pattern": "^a+$" }
5050
},
5151
"tests": [
5252
{
53-
"description": "all property names valid",
53+
"description": "matching property names valid",
5454
"data": {
55-
"f": {},
56-
"foo": {},
57-
"foobar": {},
58-
"fooBar": {}
55+
"a": {},
56+
"aa": {},
57+
"aaa": {}
5958
},
6059
"valid": true
6160
},
6261
{
63-
"description": "property name with leading capital letter is invalid",
64-
"data": {
65-
"Foo": {}
66-
},
67-
"valid": false
68-
},
69-
{
70-
"description": "property name with adjacent capital letters is invalid",
62+
"description": "non-matching property name is invalid",
7163
"data": {
72-
"fOO": {}
73-
},
74-
"valid": false
75-
},
76-
{
77-
"description": "property name with digit is invalid",
78-
"data": {
79-
"foo1": {}
64+
"aaA": {}
8065
},
8166
"valid": false
8267
},
8368
{
8469
"description": "object without properties is valid",
8570
"data": {},
8671
"valid": true
87-
},
88-
{
89-
"description": "ignores arrays",
90-
"data": [1, 2, 3, 4],
91-
"valid": true
92-
},
93-
{
94-
"description": "ignores strings",
95-
"data": "foobar",
96-
"valid": true
97-
},
98-
{
99-
"description": "ignores other non-objects",
100-
"data": 12,
101-
"valid": true
10272
}
10373
]
10474
},

tests/draft7/propertyNames.json

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,59 +46,29 @@
4646
{
4747
"description": "propertyNames validation with pattern for camelCase",
4848
"schema": {
49-
"propertyNames": { "pattern": "^[a-z]+([A-Z][a-z]+)*$" }
49+
"propertyNames": { "pattern": "^a+$" }
5050
},
5151
"tests": [
5252
{
53-
"description": "all property names valid",
53+
"description": "matching property names valid",
5454
"data": {
55-
"f": {},
56-
"foo": {},
57-
"foobar": {},
58-
"fooBar": {}
55+
"a": {},
56+
"aa": {},
57+
"aaa": {}
5958
},
6059
"valid": true
6160
},
6261
{
63-
"description": "property name with leading capital letter is invalid",
64-
"data": {
65-
"Foo": {}
66-
},
67-
"valid": false
68-
},
69-
{
70-
"description": "property name with adjacent capital letters is invalid",
62+
"description": "non-matching property name is invalid",
7163
"data": {
72-
"fOO": {}
73-
},
74-
"valid": false
75-
},
76-
{
77-
"description": "property name with digit is invalid",
78-
"data": {
79-
"foo1": {}
64+
"aaA": {}
8065
},
8166
"valid": false
8267
},
8368
{
8469
"description": "object without properties is valid",
8570
"data": {},
8671
"valid": true
87-
},
88-
{
89-
"description": "ignores arrays",
90-
"data": [1, 2, 3, 4],
91-
"valid": true
92-
},
93-
{
94-
"description": "ignores strings",
95-
"data": "foobar",
96-
"valid": true
97-
},
98-
{
99-
"description": "ignores other non-objects",
100-
"data": 12,
101-
"valid": true
10272
}
10373
]
10474
},

0 commit comments

Comments
 (0)