Skip to content

Commit 2cf1af7

Browse files
test(guardBoolean): add
1 parent 0a63af7 commit 2cf1af7

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Function.
2+
import { guardBoolean } from '../lib/guard-boolean.func';
3+
// Variables.
4+
import { FALSE_EXPECTATION, TRUE, TRUE_EXPECTATION, FALSE } from './variables/boolean.const';
5+
6+
describe(guardBoolean.name, () => {
7+
// Defined.
8+
it('is DEFINED', () => expect(guardBoolean).toBeDefined());
9+
10+
// Checks ...
11+
describe(`checks`, () => {
12+
it('callback', () => {
13+
guardBoolean(TRUE, (result: boolean, value: boolean) => {
14+
expect(result).toBe(TRUE);
15+
expect(value).toEqual(TRUE);
16+
return result;
17+
});
18+
});
19+
20+
// ... primitives.
21+
describe(`primitive`, () => {
22+
// boolean
23+
describe(`boolean`, () => {
24+
it(`${FALSE_EXPECTATION}`, () => expect(guardBoolean(FALSE)).toBe(TRUE));
25+
it(`${TRUE_EXPECTATION}`, () => expect(guardBoolean(TRUE)).toBe(TRUE));
26+
});
27+
});
28+
});
29+
});

0 commit comments

Comments
 (0)