|
1 | 1 | // Function. |
2 | 2 | import { guardBigInt } from '../lib/guard-big-int.func'; |
3 | 3 | // Variables. |
4 | | -import { BIGINT, BIGINT_EXPECTATION, BIGINT_INSTANCE } from '../../is/test/variables/big-int.const'; |
5 | | -// import { Class, CLASS } from '../../is/test/variables/class.const'; |
6 | | -// import { FUNCTION } from '../../is/test/variables/function.const'; |
7 | | -import { NULL } from '../../is/test/variables/null.const'; |
8 | | -import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from '../../is/test/variables/number.const'; |
9 | | -// import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from '../../is/test/variables/object.const'; |
10 | | -import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from '../../is/test/variables/string.const'; |
11 | | -// import { SYMBOL_NUMBER, SYMBOL_STRING } from '../../is/test/variables/symbol.const'; |
12 | | -import { TRUE, FALSE, FALSE_EXPECTATION, TRUE_EXPECTATION, TRUE_INSTANCE, FALSE_INSTANCE } from '../../is/test/variables/boolean.const'; |
13 | | -import { UNDEFINED } from '../../is/test/variables/undefined.const'; |
| 4 | +import { BIGINT, BIGINT_EXPECTATION, BIGINT_INSTANCE } from './variables/big-int.const'; |
| 5 | +import { TRUE } from './variables/boolean.const'; |
14 | 6 |
|
15 | | -describe(`guardBigInt`, () => { |
| 7 | +describe(guardBigInt.name, () => { |
16 | 8 | // Defined. |
17 | 9 | it('is DEFINED', () => expect(guardBigInt).toBeDefined()); |
18 | 10 |
|
19 | 11 | // Checks ... |
20 | 12 | describe(`checks`, () => { |
21 | 13 | it('callback', () => { |
22 | | - guardBigInt(STRING, (result: boolean) => { |
23 | | - expect(result).toBe(FALSE); |
| 14 | + guardBigInt(BIGINT, (result: boolean, value: bigint) => { |
| 15 | + expect(result).toBe(TRUE); |
| 16 | + expect(value).toEqual(BIGINT); |
24 | 17 | return result; |
25 | 18 | }); |
26 | 19 | }); |
27 | 20 |
|
28 | | - // ... arrays. |
29 | | - describe(`array`, () => { |
30 | | - // it(`${FUNCTION}`, () => expect(guardBigInt(FUNCTION, 'function')).toBe(FALSE)); |
31 | | - // it(`${Class}`, () => expect(guardBigInt(Class, 'function')).toBe(FALSE)); |
32 | | - }); |
33 | | - // ... function. |
34 | | - describe(`function`, () => { |
35 | | - // it(`FUNCTION`, () => expect(guardBigInt(FUNCTION)).toBe(FALSE)); |
36 | | - // it(`Class`, () => expect(guardBigInt(Class)).toBe(FALSE)); |
37 | | - }); |
38 | | - // ... objects. |
39 | | - describe('object', () => { |
40 | | - // it(`CLASS`, () => expect(guardBigInt(CLASS)).toBe(FALSE)); |
41 | | - // it(`OBJECT_ONE`, () => expect(guardBigInt(OBJECT_ONE)).toBe(FALSE)); |
42 | | - // it(`OBJECT_TWO`, () => expect(guardBigInt(OBJECT_TWO)).toBe(FALSE)); |
43 | | - // it(`new Object(OBJECT_ONE_NEW})`, () => expect(guardBigInt(OBJECT_ONE_NEW)).toBe(FALSE)); |
44 | | - // it(`new Object(OBJECT_TWO_NEW})`, () => expect(guardBigInt(OBJECT_TWO_NEW)).toBe(FALSE)); |
45 | | - }); |
46 | 21 | // ... primitives. |
47 | 22 | describe(`primitive`, () => { |
48 | 23 | // bigint |
49 | 24 | describe(`bigint`, () => { |
50 | 25 | it(`${BIGINT}`, () => expect(guardBigInt(BIGINT)).toBe(TRUE)); |
51 | 26 | it(`${BIGINT_EXPECTATION}`, () => expect(guardBigInt(BIGINT_INSTANCE)).toBe(TRUE)); |
52 | 27 | }); |
53 | | - |
54 | | - // boolean |
55 | | - describe(`boolean`, () => { |
56 | | - it(`${TRUE}`, () => expect(guardBigInt(TRUE)).toBe(FALSE)); |
57 | | - it(`${FALSE}`, () => expect(guardBigInt(FALSE)).toBe(FALSE)); |
58 | | - it(`${FALSE_EXPECTATION}`, () => expect(guardBigInt(TRUE_INSTANCE)).toBe(FALSE)); |
59 | | - it(`${TRUE_EXPECTATION}`, () => expect(guardBigInt(FALSE_INSTANCE)).toBe(FALSE)); |
60 | | - }); |
61 | | - |
62 | | - // null |
63 | | - it(`${NULL}`, () => expect(guardBigInt(NULL)).toBe(FALSE)); |
64 | | - |
65 | | - // number |
66 | | - describe(`number`, () => { |
67 | | - it(`${NUMBER}`, () => expect(guardBigInt(NUMBER)).toBe(FALSE)); |
68 | | - it(`Number(${NUMBER})`, () => expect(guardBigInt(NUMBER_INSTANCE)).toBe(FALSE)); |
69 | | - it(`new Number(${NUMBER})`, () => expect(guardBigInt(NUMBER_NEW_INSTANCE)).toBe(FALSE)); |
70 | | - }); |
71 | | - // string |
72 | | - describe(`string`, () => { |
73 | | - it(`${STRING}`, () => expect(guardBigInt(STRING)).toBe(FALSE)); |
74 | | - it(`String(${STRING})`, () => expect(guardBigInt(STRING_INSTANCE)).toBe(FALSE)); |
75 | | - it(`new String(${STRING})`, () => expect(guardBigInt(STRING_NEW_INSTANCE)).toBe(FALSE)); |
76 | | - }); |
77 | | - // symbol |
78 | | - describe(`symbol`, () => { |
79 | | - // it(`Symbol(${NUMBER})`, () => expect(guardBigInt(SYMBOL_NUMBER)).toBe(FALSE)); |
80 | | - // it(`Symbol(${STRING})`, () => expect(guardBigInt(SYMBOL_STRING)).toBe(FALSE)); |
81 | | - }); |
82 | | - // undefined |
83 | | - it(`${UNDEFINED}`, () => expect(guardBigInt(UNDEFINED)).toBe(FALSE)); |
84 | 28 | }); |
85 | 29 | }); |
86 | 30 | }); |
0 commit comments