deno.land / std@0.224.0 / expect / _to_strict_equal_test.ts

_to_strict_equal_test.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { expect } from "./expect.ts";import { AssertionError, assertThrows } from "../assert/mod.ts";
Deno.test("expect().toStrictEqual()", () => { expect(1).toStrictEqual(1); expect({ a: 1 }).toStrictEqual({ a: 1 });
expect(1).not.toStrictEqual(2); expect({ a: 2 }).not.toStrictEqual({ a: 1 }); expect({ a: 1, b: undefined }).not.toStrictEqual({ a: 1 });
assertThrows(() => { expect(1).toStrictEqual(2); }, AssertionError); assertThrows(() => { expect({ a: 2 }).toStrictEqual({ a: 1 }); }, AssertionError); assertThrows(() => { expect({ a: 1, b: undefined }).toStrictEqual({ a: 1 }); }, AssertionError);
assertThrows(() => { expect(1).not.toStrictEqual(1); }, AssertionError); assertThrows(() => { expect({ a: 1 }).not.toStrictEqual({ a: 1 }); }, AssertionError);
class A {} class B {} expect(new A()).not.toStrictEqual(new B()); assertThrows(() => { expect(new A()).toStrictEqual(new B()); }, AssertionError);});
std

Version Info

Tagged at
6 months ago