Skip to content

Commit 4364c72

Browse files
test: add unit test for assert for increase coverage to 100%
1 parent b922729 commit 4364c72

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/utils/src/assert.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
import { assertDefined, assertDefinedAndNotNull } from "./assert";
1+
import { assert, assertDefined, assertDefinedAndNotNull } from "./assert";
22

33
describe("assert", () => {
4+
5+
describe("assert", () => {
6+
it('assert should not throw an error when condition is truthy', () => {
7+
expect(() => assert(true)).not.toThrow();
8+
});
9+
10+
it('assert should throw an error with default message when condition is falsy', () => {
11+
expect(() => assert(false)).toThrowError("condition is not truthy");
12+
});
13+
});
14+
415
describe("assertDefined", () => {
516
it("passes for simple values", () => {
617
{

0 commit comments

Comments
 (0)