Skip to content

Commit c12ce82

Browse files
Use strict equality check by default (#68)
* test: Add failing test case. * fix: Use strict equality comparison by default.
1 parent 75b646c commit c12ce82

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎fixtures/jest/failing-spec.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ if (process.env.FAILING !== "0") {
2929
m.expect(source).toHaveSubscriptions(subs);
3030
})
3131
);
32+
33+
test(
34+
"it should fail the strict comparison check when excess properties are present",
35+
marbles(m => {
36+
interface Person {
37+
name: string;
38+
age?: number;
39+
}
40+
41+
const source = m.cold<Person>("a-", {
42+
a: { name: "Bob", age: undefined }
43+
});
44+
const expected = m.cold<Person>("a-", { a: { name: "Bob" } });
45+
46+
m.expect(source).toBeObservable(expected);
47+
})
48+
);
3249
});
3350

3451
describe("observe", () => {

‎source/jest/index.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function configure(
4040
} {
4141
const { marbles } = _configure({
4242
...configuration,
43-
assertDeepEqual: (a, e) => expect(a).toEqual(e),
43+
assertDeepEqual: (a, e) => expect(a).toStrictEqual(e),
4444
frameworkMatcher: true
4545
});
4646

@@ -66,7 +66,10 @@ export function configure(
6666
)
6767
);
6868
} else {
69-
t(c.name, marbles((m, ...rest: any[]) => func(m, c, ...rest)));
69+
t(
70+
c.name,
71+
marbles((m, ...rest: any[]) => func(m, c, ...rest))
72+
);
7073
}
7174
}, cases);
7275
});

0 commit comments

Comments
 (0)