-
-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(oneOf): add new error types (#1022)
- Loading branch information
1 parent
7360662
commit ac65aed
Showing
5 changed files
with
267 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`error message can be the return of a function 1`] = ` | ||
Array [ | ||
Object { | ||
"msg": "keep trying", | ||
"nestedErrors": Array [ | ||
Array [ | ||
Object { | ||
"location": "body", | ||
"msg": "Invalid value", | ||
"param": "foo", | ||
"value": true, | ||
}, | ||
], | ||
], | ||
"param": "_error", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`should let the user to choose between multiple error types flat error type 1`] = ` | ||
Array [ | ||
Object { | ||
"msg": "Invalid value(s)", | ||
"nestedErrors": Array [ | ||
Object { | ||
"location": "body", | ||
"msg": "Invalid value", | ||
"param": "foo", | ||
"value": true, | ||
}, | ||
Object { | ||
"location": "body", | ||
"msg": "Invalid value", | ||
"param": "bar", | ||
"value": undefined, | ||
}, | ||
], | ||
"param": "_error", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`should let the user to choose between multiple error types grouped error type 1`] = ` | ||
Array [ | ||
Object { | ||
"msg": "Invalid value(s)", | ||
"nestedErrors": Array [ | ||
Array [ | ||
Object { | ||
"location": "body", | ||
"msg": "Invalid value", | ||
"param": "foo", | ||
"value": true, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"location": "body", | ||
"msg": "Invalid value", | ||
"param": "bar", | ||
"value": undefined, | ||
}, | ||
], | ||
], | ||
"param": "_error", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`should let the user to choose between multiple error types leastErroredOnly error type 1`] = ` | ||
Array [ | ||
Object { | ||
"msg": "Invalid value(s)", | ||
"nestedErrors": Array [ | ||
Object { | ||
"location": "body", | ||
"msg": "Invalid value", | ||
"param": "foo", | ||
"value": true, | ||
}, | ||
], | ||
"param": "_error", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`with a list of chain groups sets a single error for the _error key 1`] = ` | ||
Array [ | ||
Object { | ||
"msg": "Invalid value(s)", | ||
"nestedErrors": Array [ | ||
Array [ | ||
Object { | ||
"location": "cookies", | ||
"msg": "Invalid value", | ||
"param": "foo", | ||
"value": true, | ||
}, | ||
Object { | ||
"location": "cookies", | ||
"msg": "Invalid value", | ||
"param": "bar", | ||
"value": "def", | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"location": "cookies", | ||
"msg": "Invalid value", | ||
"param": "baz", | ||
"value": 123, | ||
}, | ||
], | ||
], | ||
"param": "_error", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`with a list of chains sets a single error for the _error key 1`] = ` | ||
Array [ | ||
Object { | ||
"msg": "Invalid value(s)", | ||
"nestedErrors": Array [ | ||
Array [ | ||
Object { | ||
"location": "cookies", | ||
"msg": "Invalid value", | ||
"param": "foo", | ||
"value": true, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"location": "cookies", | ||
"msg": "Invalid value", | ||
"param": "bar", | ||
"value": "def", | ||
}, | ||
], | ||
], | ||
"param": "_error", | ||
}, | ||
] | ||
`; |
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
Oops, something went wrong.