Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Feb 28, 2021
1 parent aebbb2d commit 89e6f89
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import { errorSchema } from "../error-schema"

test(`throws invalid on an invalid error`, () => {
expect(errorSchema.validate({ lol: `true` })).rejects.toBeDefined()
test(`returns invalid on an invalid error`, () => {
expect(errorSchema.validate({ lol: `true` })).toMatchInlineSnapshot(`
Object {
"error": [ValidationError: "lol" is not allowed],
"value": Object {
"lol": "true",
},
}
`)
})

test(`does not throw on a valid schema`, () => {
test(`returns a valid value`, () => {
expect(
errorSchema.validate({
context: {},
})
).resolves.toEqual(expect.any(Object))
).toMatchInlineSnapshot(`
Object {
"value": Object {
"context": Object {},
},
}
`)
})

0 comments on commit 89e6f89

Please sign in to comment.