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

_anything_test.ts
نووسراو ببینە
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
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { expect } from "./expect.ts";import { AssertionError, assertThrows } from "../assert/mod.ts";import { fn } from "./fn.ts";
Deno.test("expect.anything() as a parameter of toEqual()", () => { expect(null).not.toEqual(expect.anything()); expect(undefined).not.toEqual(expect.anything()); expect(1).toEqual(expect.anything());
assertThrows(() => { expect(null).toEqual(expect.anything()); }, AssertionError); assertThrows(() => { expect(undefined).toEqual(expect.anything()); }, AssertionError); assertThrows(() => { expect(1).not.toEqual(expect.anything()); }, AssertionError);});
Deno.test("expect.anything() as a parameter of toHaveBeenCalled()", () => { const mockFn = fn(); mockFn(3); expect(mockFn).toHaveBeenCalledWith(expect.anything());});
std

Version Info

Tagged at
3 weeks ago