-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(n4s): deeply nested schema result (#555)
- Loading branch information
Showing
92 changed files
with
2,971 additions
and
876 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
jsconfig.json linguist-generated | ||
jsconfig.json linguist-generated | ||
rules.ts linguist-generated |
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ on: | |
push: | ||
branches: | ||
- release | ||
- latest | ||
|
||
jobs: | ||
build: | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 @@ | ||
/** | ||
* A safe hasOwnProperty access | ||
*/ | ||
export default function hasOwnProperty(obj, key) { | ||
return Object.prototype.hasOwnProperty.call(obj, key); | ||
} |
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,4 @@ | ||
const HAS_WARNINGS = 'hasWarnings'; | ||
const HAS_ERRORS = 'hasErrors'; | ||
|
||
export { HAS_WARNINGS, HAS_ERRORS }; |
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,14 @@ | ||
expect.extend({ | ||
toPass: res => ({ | ||
pass: res.pass, | ||
message: () => 'enforceResult.pass failed validation', | ||
}), | ||
toPassWith: (enforcement, value) => { | ||
return { | ||
pass: | ||
enforcement.run(value).pass === true && | ||
enforcement.test(value) === true, | ||
message: () => 'enforceResult.pass failed validation', | ||
}; | ||
}, | ||
}); |
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
147 changes: 147 additions & 0 deletions
147
packages/n4s/src/__tests__/__snapshots__/deep.test.js.snap
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[`Deep enforcements Should match a failing snapshot 1`] = ` | ||
RuleResult { | ||
"children": Object { | ||
"age": RuleResult { | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"country": RuleResult { | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"user": RuleResult { | ||
"failed": true, | ||
"hasErrors": true, | ||
}, | ||
}, | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
} | ||
`; | ||
|
||
exports[`Deep enforcements Should match a partially failing shapshot 1`] = ` | ||
RuleResult { | ||
"children": Object { | ||
"age": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"country": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"user": RuleResult { | ||
"children": Object { | ||
"id": RuleResult { | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"name": RuleResult { | ||
"children": Object { | ||
"first": RuleResult { | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"last": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"middle": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
}, | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
}, | ||
}, | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
}, | ||
}, | ||
"failed": true, | ||
"hasErrors": true, | ||
"hasWarnings": false, | ||
} | ||
`; | ||
|
||
exports[`Deep enforcements Should match sucessful shapshot 1`] = ` | ||
RuleResult { | ||
"children": Object { | ||
"age": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"country": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"user": RuleResult { | ||
"children": Object { | ||
"id": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"name": RuleResult { | ||
"children": Object { | ||
"first": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"last": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
"middle": RuleResult { | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
"warn": false, | ||
}, | ||
}, | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
}, | ||
}, | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
}, | ||
}, | ||
"failed": false, | ||
"hasErrors": false, | ||
"hasWarnings": false, | ||
} | ||
`; |
Oops, something went wrong.