Skip to content

Commit

Permalink
test: result should always be a Promise
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoniangreen committed Apr 24, 2024
1 parent 8f3b729 commit 12bfffa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/types/async-validate.spec.ts
Expand Up @@ -109,10 +109,10 @@ describe("$async validation and type guards", () => {
const data: unknown = {foo: 1}
let result: boolean | Promise<Foo>
if ((result = validate(data))) {
if (typeof result == "boolean") {
;(data as any).foo.should.equal(1)
} else {
if (result instanceof Promise) {
await result.then((_data) => _data.foo.should.equal(1))
} else {
should.fail()
}
} else {
should.fail()
Expand Down

0 comments on commit 12bfffa

Please sign in to comment.