This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: aligns test suites for gavel-spec v2
- Loading branch information
1 parent
cbb91d3
commit 71a02bc
Showing
17 changed files
with
320 additions
and
189 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
function isValidComponent(errors) { | ||
return errors.every((error) => error.severity !== 'error'); | ||
} | ||
|
||
// Returns a boolean indicating whether a given validation result | ||
// concludes two HTTP messages as valid (matching). | ||
// Separated into its own util only to be used in both next and legacy API. | ||
// TODO Move to "validateMessage" after legacy "gavel.validate()" removal. | ||
function isValid(validationResult) { | ||
return Object.values(validationResult).every((resultGroup) => { | ||
return resultGroup.results.every((result) => result.severity !== 'error'); | ||
return Object.values(validationResult.field).every((resultGroup) => { | ||
return isValidComponent(resultGroup.errors); | ||
}); | ||
} | ||
|
||
module.exports = { isValid }; | ||
module.exports = { isValid, isValidComponent }; |
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
Oops, something went wrong.