-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests and refactor jsondatamodel
- Loading branch information
1 parent
ed81fb6
commit ee4527a
Showing
20 changed files
with
1,048 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...n.App.Core.Tests/Features/Validators/shared-expression-validation-tests/hidden-field.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "Should not return an error if component is hidden", | ||
"expects": [], | ||
"validationConfig": { | ||
"$schema": "https://altinncdn.no/schemas/json/validation/validation.schema.v1.json", | ||
"validations": { | ||
"form.name": ["none-is-not-allowed"] | ||
}, | ||
"definitions": { | ||
"none-is-not-allowed": { | ||
"message": "none is not allowed", | ||
"severity": "errors", | ||
"condition": ["equals", ["dataModel", ["argv", 0]], "none"] | ||
} | ||
} | ||
}, | ||
"formData": { | ||
"form": { | ||
"name": "none" | ||
} | ||
}, | ||
"layouts": { | ||
"Page": { | ||
"$schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json", | ||
"data": { | ||
"layout": [ | ||
{ | ||
"id": "name-input", | ||
"type": "Input", | ||
"dataModelBindings": { | ||
"simpleBinding": "form.name" | ||
}, | ||
"hidden": true | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...nn.App.Core.Tests/Features/Validators/shared-expression-validation-tests/hidden-page.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "Should not return an error if page is hidden", | ||
"expects": [], | ||
"validationConfig": { | ||
"$schema": "https://altinncdn.no/schemas/json/validation/validation.schema.v1.json", | ||
"validations": { | ||
"form.name": ["none-is-not-allowed"] | ||
}, | ||
"definitions": { | ||
"none-is-not-allowed": { | ||
"message": "none is not allowed", | ||
"severity": "errors", | ||
"condition": ["equals", ["dataModel", ["argv", 0]], "none"] | ||
} | ||
} | ||
}, | ||
"formData": { | ||
"form": { | ||
"name": "none" | ||
} | ||
}, | ||
"layouts": { | ||
"Page": { | ||
"$schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json", | ||
"data": { | ||
"hidden": true, | ||
"layout": [ | ||
{ | ||
"id": "name-input", | ||
"type": "Input", | ||
"dataModelBindings": { | ||
"simpleBinding": "form.name" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
...nn.App.Core.Tests/Features/Validators/shared-expression-validation-tests/many-errors.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"name": "Should return all of the correct errors", | ||
"expects": [ | ||
{ | ||
"message": "none is not allowed", | ||
"severity": "errors", | ||
"field": "form.name", | ||
"componentId": "name-input" | ||
}, | ||
{ | ||
"message": "string is too short", | ||
"severity": "errors", | ||
"field": "form.name", | ||
"componentId": "name-input" | ||
}, | ||
{ | ||
"message": "email must be real", | ||
"severity": "errors", | ||
"field": "form.email", | ||
"componentId": "email-input" | ||
}, | ||
{ | ||
"message": "string is too short", | ||
"severity": "errors", | ||
"field": "form.email", | ||
"componentId": "email-input" | ||
} | ||
], | ||
"validationConfig": { | ||
"$schema": "https://altinncdn.no/schemas/json/validation/validation.schema.v1.json", | ||
"validations": { | ||
"form.name": [ | ||
"none-is-not-allowed", | ||
"str-len", | ||
{ | ||
"message": "this should not be shown", | ||
"severity": "warnings", | ||
"condition": ["startsWith", ["dataModel", ["argv", 0]], "a"] | ||
} | ||
], | ||
"form.email": [ | ||
"none-is-not-allowed", | ||
{ | ||
"message": "email must be real", | ||
"severity": "errors", | ||
"condition": ["contains", ["dataModel", ["argv", 0]], "fake"] | ||
}, | ||
{ | ||
"ref": "str-len", | ||
"condition": ["lessThan", ["stringLength", ["dataModel", ["argv", 0]]], 20] | ||
}, | ||
{ | ||
"message": "email must contain @", | ||
"severity": "errors", | ||
"condition": ["notContains", ["dataModel", ["argv", 0]], "@"] | ||
} | ||
] | ||
}, | ||
"definitions": { | ||
"none-is-not-allowed": { | ||
"message": "none is not allowed", | ||
"severity": "errors", | ||
"condition": ["equals", ["dataModel", ["argv", 0]], "none"] | ||
}, | ||
"str-len": { | ||
"message": "string is too short", | ||
"severity": "errors", | ||
"condition": ["lessThan", ["stringLength", ["dataModel", ["argv", 0]]], 5] | ||
} | ||
} | ||
}, | ||
"formData": { | ||
"form": { | ||
"name": "none", | ||
"email": "[email protected]" | ||
} | ||
}, | ||
"layouts": { | ||
"Page": { | ||
"$schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json", | ||
"data": { | ||
"layout": [ | ||
{ | ||
"id": "name-input", | ||
"type": "Input", | ||
"dataModelBindings": { | ||
"simpleBinding": "form.name" | ||
} | ||
}, | ||
{ | ||
"id": "email-input", | ||
"type": "Input", | ||
"dataModelBindings": { | ||
"simpleBinding": "form.email" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.