Skip to content

Commit 656c837

Browse files
committed
add simple mock assertions
1 parent 72e18a0 commit 656c837

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { test } from "node:test";
2+
import assert from "node:assert/strict";
3+
4+
test("Simple mock assertions", (t) => {
5+
const mockFn = t.mock.fn();
6+
7+
mockFn("call-arg-1", "call-arg-2");
8+
assert.deepEqual(mockFn.mock.calls[0].arguments, [
9+
"call-arg-1",
10+
"call-arg-2",
11+
]);
12+
assert.equal(mockFn.mock.callCount(), 1);
13+
14+
mockFn("call-arg-3", "call-arg-4");
15+
assert.equal(mockFn.mock.callCount(), 2);
16+
});

0 commit comments

Comments
 (0)