Skip to content

Commit 53630a6

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
add expect().toBeNull() (#47716)
Summary: Pull Request resolved: #47716 Add toBeNull check to Fantom. Jest docs: https://jestjs.io/docs/expect#tobenull Differential Revision: D66167811
1 parent 6f1ae91 commit 53630a6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

jest/integration/runtime/setup.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,15 @@ class Expect {
224224
}
225225
}
226226

227+
toBeNull(): void {
228+
const pass = this.#received == null;
229+
if (!this.#isExpectedResult(pass)) {
230+
throw new Error(
231+
`Expected ${String(this.#received)}${this.#maybeNotLabel()} to be null`,
232+
);
233+
}
234+
}
235+
227236
toThrow(expected?: string): void {
228237
if (expected != null && typeof expected !== 'string') {
229238
throw new Error(

0 commit comments

Comments
 (0)