mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 12:39:27 +00:00
add expect().toBeNull() (#47716)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
parent
8fba7ebb5e
commit
6f1cf004fa
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user