Skip to content

Commit

Permalink
Check expected values within subtest (#1043)
Browse files Browse the repository at this point in the history
Previously, the value check was performed outside the scope of the
test() call in util.test.ts, making failure output misleading.
  • Loading branch information
apasel422 authored Sep 26, 2023
1 parent e567536 commit b0631c0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ts/src/header-validator/validate-json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ export function run<T>(
tc: TestCase<T>,
f: () => [context.ValidationResult, Maybe<T>]
): void {
const [validationResult, value] = f()
testutil.run(tc, tc.name, () => validationResult)

if (tc.expected !== undefined) {
assert.deepEqual(value, tc.expected, tc.name)
}
testutil.run(tc, tc.name, () => {
const [validationResult, value] = f()
if (tc.expected !== undefined) {
assert.deepEqual(value, tc.expected)
}
return validationResult
})
}

0 comments on commit b0631c0

Please sign in to comment.