2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-11-21 14:52:38 +00:00
|
|
|
|
|
|
|
import { expect } from "./expect.ts";
|
|
|
|
import { fn } from "./fn.ts";
|
2024-04-29 02:57:30 +00:00
|
|
|
import { AssertionError, assertThrows } from "@std/assert";
|
2023-11-21 14:52:38 +00:00
|
|
|
|
|
|
|
Deno.test("expect().toHaveBeenCalledWith()", () => {
|
|
|
|
const mockFn = fn();
|
|
|
|
mockFn("hello", "deno");
|
|
|
|
|
|
|
|
expect(mockFn).toHaveBeenCalledWith("hello", "deno");
|
|
|
|
|
|
|
|
expect(mockFn).not.toHaveBeenCalledWith("hello", "DENO");
|
|
|
|
|
|
|
|
assertThrows(() => {
|
|
|
|
expect(mockFn).toHaveBeenCalledWith("hello", "DENO");
|
|
|
|
}, AssertionError);
|
|
|
|
|
|
|
|
assertThrows(() => {
|
|
|
|
expect(mockFn).not.toHaveBeenCalledWith("hello", "deno");
|
|
|
|
});
|
|
|
|
});
|