Skip to content

Commit

Permalink
Fix some broken expectations in RN integration tests
Browse files Browse the repository at this point in the history
Differential Revision: D65952221
  • Loading branch information
rubennorte authored and facebook-github-bot committed Nov 14, 2024
1 parent db3c1a4 commit bd246d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jest/integration/runtime/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class Expect {
}

toBe(expected: mixed): void {
const pass = this.#received !== expected;
if (this.#isExpectedResult(pass)) {
const pass = this.#received === expected;
if (!this.#isExpectedResult(pass)) {
throw new Error(
`Expected ${String(expected)} but received ${String(this.#received)}.`,
);
Expand All @@ -81,7 +81,7 @@ class Expect {

toBeInstanceOf(expected: Class<mixed>): void {
const pass = this.#received instanceof expected;
if (!pass) {
if (!this.#isExpectedResult(pass)) {
throw new Error(
`expected ${String(this.#received)} to be an instance of ${String(expected)}`,
);
Expand All @@ -91,7 +91,7 @@ class Expect {
toBeCloseTo(expected: number, precision: number = 2): void {
const pass =
Math.abs(expected - Number(this.#received)) < Math.pow(10, -precision);
if (!pass) {
if (!this.#isExpectedResult(pass)) {
throw new Error(
`expected ${String(this.#received)} to be close to ${expected}`,
);
Expand All @@ -110,7 +110,7 @@ class Expect {
} catch {
pass = true;
}
if (!pass) {
if (!this.#isExpectedResult(pass)) {
throw new Error(`expected ${String(this.#received)} to throw`);
}
}
Expand Down

0 comments on commit bd246d2

Please sign in to comment.