Skip to content

Commit

Permalink
add expect().toBeNull() (facebook#47716)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#47716

changelog: [internal]

Add toBeNull check to Fantom.

Jest docs: https://jestjs.io/docs/expect#tobenull

Reviewed By: javache

Differential Revision: D66167811

fbshipit-source-id: 33b6cf362bcf1636f41b78dc6c84905b80be994e
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Nov 19, 2024
1 parent 8fba7eb commit 6f1cf00
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jest/integration/runtime/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ class Expect {
}
}

toBeNull(): void {
const pass = this.#received == null;
if (!this.#isExpectedResult(pass)) {
throw new Error(
`Expected ${String(this.#received)}${this.#maybeNotLabel()} to be null`,
);
}
}

toThrow(expected?: string): void {
if (expected != null && typeof expected !== 'string') {
throw new Error(
Expand Down

0 comments on commit 6f1cf00

Please sign in to comment.