Skip to content

Commit 0a63af7

Browse files
test: update
1 parent 3405661 commit 0a63af7

16 files changed

Lines changed: 60 additions & 175 deletions
Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// Function.
22
import { guardArray } from '../lib/guard-array.func';
33
// Variables.
4-
import { BIGINT, BIGINT_INSTANCE } from '../../is/test/variables/big-int.const';
5-
import { Class } from '../../is/test/variables/class.const';
6-
import { Func } from '../../type/func.type';
7-
import { ObjectOne, ObjectTwo, OBJECT_ONE, OBJECT_TWO } from '../../is/test/variables/object.const';
84
import {
95
ARRAY_BIGINT,
106
ARRAY_BOOLEAN,
@@ -18,60 +14,31 @@ import {
1814
ARRAY_SYMBOL_NUMBER,
1915
ARRAY_SYMBOL_STRING,
2016
ARRAY_UNDEFINED
21-
} from '../../is/test/variables/array.const';
22-
import { FALSE, TRUE, FALSE_INSTANCE, TRUE_INSTANCE } from '../../is/test/variables/boolean.const';
23-
import { FUNCTION } from '../../is/test/variables/function.const';
24-
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from '../../is/test/variables/number.const';
25-
import { STRING, STRING_INSTANCE } from '../../is/test/variables/string.const';
26-
import { SYMBOL_NUMBER, SYMBOL_STRING } from '../../is/test/variables/symbol.const';
27-
import { UNDEFINED } from '../../is/test/variables/undefined.const';
28-
import { notDefined } from '../../is/test/variables/not-defined.const';
17+
} from './variables/array.const';
18+
import { Class } from './variables/class.const';
19+
import { Func } from '../../type/func.type';
20+
import { ObjectOne, ObjectTwo } from './variables/object.const';
2921

30-
describe('guardArray', () => {
22+
describe(guardArray.name, () => {
3123
// TRUE
3224
it('is DEFINED', () => {
3325
expect(guardArray).toBeDefined();
3426
});
3527

3628
it('Array<bigint>', () => expect(guardArray<bigint>(ARRAY_BIGINT)).toBeTruthy());
37-
it('Array<boolean>', () => expect(guardArray<boolean>(ARRAY_BOOLEAN)).toBeTruthy());
29+
it('Array<boolean>', () => expect(guardArray<boolean | Boolean>(ARRAY_BOOLEAN)).toBeTruthy());
3830
it('Array<Class>', () => expect(guardArray<Class>(ARRAY_CLASS)).toBeTruthy());
3931
it('Array<Func>', () => expect(guardArray<Func>(ARRAY_FUNCTION)).toBeTruthy());
4032
it('Array<null>', () => expect(guardArray<null>(ARRAY_NULL)).toBeTruthy());
41-
it('Array<number>', () => expect(guardArray<number>(ARRAY_NUMBER)).toBeTruthy());
33+
it('Array<number>', () => expect(guardArray<number | Number>(ARRAY_NUMBER)).toBeTruthy());
4234
it('Array<ObjectOne> Array<ObjectTwo>', () => {
4335
expect(guardArray<ObjectOne>(ARRAY_OBJECT_ONE)).toBeTruthy();
4436
expect(guardArray<ObjectTwo>(ARRAY_OBJECT_TWO)).toBeTruthy();
4537
});
46-
it('Array<string>', () => expect(guardArray<string>(ARRAY_STRING)).toBeTruthy());
38+
it('Array<string>', () => expect(guardArray<string | String>(ARRAY_STRING)).toBeTruthy());
4739
it('Array<symbol>', () => {
4840
expect(guardArray<symbol>(ARRAY_SYMBOL_STRING)).toBeTruthy();
4941
expect(guardArray<symbol>(ARRAY_SYMBOL_NUMBER)).toBeTruthy();
5042
});
5143
it('Array<undefined>', () => expect(guardArray<undefined>(ARRAY_UNDEFINED)).toBeTruthy());
52-
53-
// FALSE
54-
it(`'bigint'`, () => {
55-
expect(guardArray(BIGINT)).toBeFalsy();
56-
expect(guardArray(BIGINT_INSTANCE)).toBeFalsy();
57-
});
58-
it(`'boolean' | Boolean`, () => {
59-
expect(guardArray(FALSE)).toBeFalsy();
60-
expect(guardArray(TRUE)).toBeFalsy();
61-
expect(guardArray(FALSE_INSTANCE)).toBeFalsy();
62-
expect(guardArray(TRUE_INSTANCE)).toBeFalsy();
63-
});
64-
it(`'number' | Number`, () => {
65-
expect(guardArray(NUMBER)).toBeFalsy();
66-
expect(guardArray(NUMBER_INSTANCE)).toBeFalsy();
67-
expect(guardArray(NUMBER_NEW_INSTANCE)).toBeFalsy();
68-
});
69-
it(`'string' | String`, () => {
70-
expect(guardArray<string>(STRING)).toBeFalsy();
71-
expect(guardArray<string>(STRING_INSTANCE)).toBeFalsy();
72-
});
73-
it(`'undefined'`, () => {
74-
expect(guardArray<undefined>(notDefined)).toBeFalse();
75-
expect(guardArray<undefined>(UNDEFINED)).toBeFalse();
76-
});
7744
});
Lines changed: 6 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,30 @@
11
// Function.
22
import { guardBigInt } from '../lib/guard-big-int.func';
33
// 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';
146

15-
describe(`guardBigInt`, () => {
7+
describe(guardBigInt.name, () => {
168
// Defined.
179
it('is DEFINED', () => expect(guardBigInt).toBeDefined());
1810

1911
// Checks ...
2012
describe(`checks`, () => {
2113
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);
2417
return result;
2518
});
2619
});
2720

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-
});
4621
// ... primitives.
4722
describe(`primitive`, () => {
4823
// bigint
4924
describe(`bigint`, () => {
5025
it(`${BIGINT}`, () => expect(guardBigInt(BIGINT)).toBe(TRUE));
5126
it(`${BIGINT_EXPECTATION}`, () => expect(guardBigInt(BIGINT_INSTANCE)).toBe(TRUE));
5227
});
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));
8428
});
8529
});
8630
});

packages/type/src/is/test/is-instance.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import { Class, CLASS, PERSON, Person, PersonCopy, PERSON_COPY } from './variabl
77
import { FUNCTION } from './variables/function.const';
88
import { NULL } from './variables/null.const';
99
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
// import { OBJECT_ONE, OBJECT_TWO } from './variables/object.const';
1110
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
12-
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1311
import { UNDEFINED } from './variables/undefined.const';
1412
import { notDefined } from './variables/not-defined.const';
1513

packages/type/src/is/test/is-key.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FALSE, TRUE, FALSE_INSTANCE, TRUE_INSTANCE, FALSE_EXPECTATION, TRUE_EXP
77
import { FUNCTION } from './variables/function.const';
88
import { NULL } from './variables/null.const';
99
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
import { OBJECT_ONE, OBJECT_TWO, ObjectOne, ObjectTwo, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
10+
import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
1111
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
1212
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1313
import { UNDEFINED } from './variables/undefined.const';
@@ -54,8 +54,8 @@ describe(isKey.name, () => {
5454
describe(`boolean`, () => {
5555
it(`${TRUE}`, () => expect(isKey(TRUE)).toBe(FALSE));
5656
it(`${FALSE}`, () => expect(isKey(FALSE)).toBe(FALSE));
57-
it(`${FALSE_EXPECTATION}`, () => expect(isKey(TRUE_INSTANCE)).toBe(FALSE));
58-
it(`${TRUE_EXPECTATION}`, () => expect(isKey(FALSE_INSTANCE)).toBe(FALSE));
57+
it(`${TRUE_EXPECTATION}`, () => expect(isKey(TRUE_INSTANCE)).toBe(FALSE));
58+
it(`${FALSE_EXPECTATION}`, () => expect(isKey(FALSE_INSTANCE)).toBe(FALSE));
5959
});
6060

6161
// null

packages/type/src/is/test/is-number-object.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FALSE, TRUE, FALSE_INSTANCE, TRUE_INSTANCE, FALSE_EXPECTATION, TRUE_EXP
77
import { FUNCTION } from './variables/function.const';
88
import { NULL } from './variables/null.const';
99
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
import { OBJECT_ONE, OBJECT_TWO, ObjectOne, ObjectTwo, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
10+
import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
1111
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
1212
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1313
import { UNDEFINED } from './variables/undefined.const';
@@ -58,8 +58,8 @@ describe(isNumberObject.name, () => {
5858
describe(`boolean`, () => {
5959
it(`${TRUE}`, () => expect(isNumberObject(TRUE)).toBe(FALSE));
6060
it(`${FALSE}`, () => expect(isNumberObject(FALSE)).toBe(FALSE));
61-
it(`${FALSE_EXPECTATION}`, () => expect(isNumberObject(TRUE_INSTANCE)).toBe(FALSE));
62-
it(`${TRUE_EXPECTATION}`, () => expect(isNumberObject(FALSE_INSTANCE)).toBe(FALSE));
61+
it(`${TRUE_EXPECTATION}`, () => expect(isNumberObject(TRUE_INSTANCE)).toBe(FALSE));
62+
it(`${FALSE_EXPECTATION}`, () => expect(isNumberObject(FALSE_INSTANCE)).toBe(FALSE));
6363
});
6464

6565
// null

packages/type/src/is/test/is-number-type.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FALSE, TRUE, FALSE_INSTANCE, TRUE_INSTANCE, FALSE_EXPECTATION, TRUE_EXP
77
import { FUNCTION } from './variables/function.const';
88
import { NULL } from './variables/null.const';
99
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
import { OBJECT_ONE, OBJECT_TWO, ObjectOne, ObjectTwo, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
10+
import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
1111
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
1212
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1313
import { UNDEFINED } from './variables/undefined.const';
@@ -60,8 +60,8 @@ describe(isNumberType.name, () => {
6060
describe(`boolean`, () => {
6161
it(`${TRUE}`, () => expect(isNumberType(TRUE)).toBe(FALSE));
6262
it(`${FALSE}`, () => expect(isNumberType(FALSE)).toBe(FALSE));
63-
it(`${FALSE_EXPECTATION}`, () => expect(isNumberType(TRUE_INSTANCE)).toBe(FALSE));
64-
it(`${TRUE_EXPECTATION}`, () => expect(isNumberType(FALSE_INSTANCE)).toBe(FALSE));
63+
it(`${TRUE_EXPECTATION}`, () => expect(isNumberType(TRUE_INSTANCE)).toBe(FALSE));
64+
it(`${FALSE_EXPECTATION}`, () => expect(isNumberType(FALSE_INSTANCE)).toBe(FALSE));
6565
});
6666

6767
// null

packages/type/src/is/test/is-object-key-in.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FALSE, TRUE, TRUE_INSTANCE, FALSE_INSTANCE, FALSE_EXPECTATION, TRUE_EXP
77
import { FUNCTION } from './variables/function.const';
88
import { NULL } from './variables/null.const';
99
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW, ObjectTwo, ObjectOne } from './variables/object.const';
10+
import { OBJECT_ONE } from './variables/object.const';
1111
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
1212
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1313
import { UNDEFINED } from './variables/undefined.const';
@@ -115,8 +115,8 @@ describe(isObjectKeyIn.name , () => {
115115
describe(`boolean`, () => {
116116
it(`${TRUE}`, () => expect(isObjectKeyIn(TRUE, 'boolean')).toBe(FALSE));
117117
it(`${FALSE}`, () => expect(isObjectKeyIn(FALSE, 'boolean')).toBe(FALSE));
118-
it(`${FALSE_EXPECTATION}`, () => expect(isObjectKeyIn(TRUE_INSTANCE, 'boolean')).toBe(FALSE));
119-
it(`${TRUE_EXPECTATION}`, () => expect(isObjectKeyIn(FALSE_INSTANCE, 'boolean')).toBe(FALSE));
118+
it(`${TRUE_EXPECTATION}`, () => expect(isObjectKeyIn(TRUE_INSTANCE, 'boolean')).toBe(FALSE));
119+
it(`${FALSE_EXPECTATION}`, () => expect(isObjectKeyIn(FALSE_INSTANCE, 'boolean')).toBe(FALSE));
120120
});
121121

122122
// null

packages/type/src/is/test/is-object-key.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FALSE, TRUE, TRUE_INSTANCE, FALSE_INSTANCE, FALSE_EXPECTATION, TRUE_EXP
77
import { FUNCTION } from './variables/function.const';
88
import { NULL } from './variables/null.const';
99
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW, ObjectTwo, ObjectOne } from './variables/object.const';
10+
import { OBJECT_ONE } from './variables/object.const';
1111
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
1212
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1313
import { UNDEFINED } from './variables/undefined.const';
@@ -117,8 +117,8 @@ describe(isObjectKey.name , () => {
117117
describe(`boolean`, () => {
118118
it(`${TRUE}`, () => expect(isObjectKey(TRUE, 'boolean')).toBe(FALSE));
119119
it(`${FALSE}`, () => expect(isObjectKey(FALSE, 'boolean')).toBe(FALSE));
120-
it(`${FALSE_EXPECTATION}`, () => expect(isObjectKey(TRUE_INSTANCE, 'boolean')).toBe(FALSE));
121-
it(`${TRUE_EXPECTATION}`, () => expect(isObjectKey(FALSE_INSTANCE, 'boolean')).toBe(FALSE));
120+
it(`${TRUE_EXPECTATION}`, () => expect(isObjectKey(TRUE_INSTANCE, 'boolean')).toBe(FALSE));
121+
it(`${FALSE_EXPECTATION}`, () => expect(isObjectKey(FALSE_INSTANCE, 'boolean')).toBe(FALSE));
122122
});
123123

124124
// null

packages/type/src/is/test/is-object.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FALSE, TRUE, FALSE_INSTANCE, TRUE_INSTANCE, FALSE_EXPECTATION, TRUE_EXP
77
import { FUNCTION } from './variables/function.const';
88
import { NULL } from './variables/null.const';
99
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
import { OBJECT_ONE, OBJECT_TWO, ObjectOne, ObjectTwo, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
10+
import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW } from './variables/object.const';
1111
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
1212
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1313
import { UNDEFINED } from './variables/undefined.const';
@@ -57,8 +57,8 @@ describe(isObject.name, () => {
5757
describe(`boolean`, () => {
5858
it(`${TRUE}`, () => expect(isObject(TRUE)).toBe(FALSE));
5959
it(`${FALSE}`, () => expect(isObject(FALSE)).toBe(FALSE));
60-
it(`${FALSE_EXPECTATION}`, () => expect(isObject(TRUE_INSTANCE)).toBe(FALSE));
61-
it(`${TRUE_EXPECTATION}`, () => expect(isObject(FALSE_INSTANCE)).toBe(FALSE));
60+
it(`${TRUE_EXPECTATION}`, () => expect(isObject(TRUE_INSTANCE)).toBe(FALSE));
61+
it(`${FALSE_EXPECTATION}`, () => expect(isObject(FALSE_INSTANCE)).toBe(FALSE));
6262
});
6363

6464
// null

packages/type/src/is/test/is-primitive.spec.ts

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
import { isPrimitive } from '../lib/is-primitive.func';
33
// Variables.
44
import { BIGINT, BIGINT_EXPECTATION, BIGINT_INSTANCE } from './variables/big-int.const';
5-
import { Class, CLASS } from './variables/class.const';
65
import { FALSE, TRUE, TRUE_INSTANCE, FALSE_INSTANCE, FALSE_EXPECTATION, TRUE_EXPECTATION } from './variables/boolean.const';
7-
import { FUNCTION } from './variables/function.const';
86
import { NULL } from './variables/null.const';
97
import { NUMBER, NUMBER_INSTANCE, NUMBER_NEW_INSTANCE } from './variables/number.const';
10-
import { OBJECT_ONE, OBJECT_TWO, OBJECT_ONE_NEW, OBJECT_TWO_NEW, ObjectTwo, ObjectOne } from './variables/object.const';
118
import { STRING, STRING_INSTANCE, STRING_NEW_INSTANCE } from './variables/string.const';
129
import { SYMBOL_NUMBER, SYMBOL_STRING } from './variables/symbol.const';
1310
import { UNDEFINED } from './variables/undefined.const';
@@ -18,30 +15,13 @@ describe(isPrimitive.name, () => {
1815

1916
// Checks ...
2017
describe(`checks`, () => {
21-
// it('callback', () => {
22-
// isPrimitive('test', (result: boolean) => {
23-
// expect(result).toBe(TRUE);
24-
// return result;
25-
// });
26-
// });
27-
28-
// ... instance.
29-
// describe(`instance`, () => it(`Class`, () => expect(isPrimitive<Class>(CLASS, Class)).toBe(TRUE)));
30-
31-
// ... function.
32-
// describe(`function`, () => {
33-
// it(`${FUNCTION}`, () => expect(isPrimitive(FUNCTION, 'function')).toBe(TRUE));
34-
// it(`${CLASS}`, () => expect(isPrimitive(Class, 'function')).toBe(TRUE));
35-
// });
36-
37-
// ... objects.
38-
// describe('object', () => {
39-
// it(`CLASS`, () => expect(isPrimitive(CLASS, 'object')).toBe(TRUE));
40-
// it(`OBJECT_ONE`, () => expect(isPrimitive<ObjectOne>(OBJECT_ONE, 'object')).toBe(TRUE));
41-
// it(`OBJECT_ONE_NEW`, () => expect(isPrimitive<ObjectTwo>(OBJECT_TWO, 'object')).toBe(TRUE));
42-
// it(`new Object(OBJECT_ONE_NEW)`, () => expect(isPrimitive<ObjectOne>(OBJECT_ONE_NEW, 'object')).toBe(TRUE));
43-
// it(`new Object(OBJECT_TWO_NEW)`, () => expect(isPrimitive<ObjectTwo>(OBJECT_TWO_NEW, 'object')).toBe(TRUE));
44-
// });
18+
it('callback', () => {
19+
isPrimitive<string>(STRING, 'string' , (result: boolean, value: string) => {
20+
expect(result).toBe(TRUE);
21+
expect(value).toEqual(STRING);
22+
return result;
23+
});
24+
});
4525

4626
// ... primitives.
4727
describe(`primitive`, () => {
@@ -55,8 +35,8 @@ describe(isPrimitive.name, () => {
5535
describe(`boolean`, () => {
5636
it(`${TRUE}`, () => expect(isPrimitive(TRUE, 'boolean')).toBe(TRUE));
5737
it(`${FALSE}`, () => expect(isPrimitive(FALSE, 'boolean')).toBe(TRUE));
58-
it(`${FALSE_EXPECTATION}`, () => expect(isPrimitive(TRUE_INSTANCE, 'boolean')).toBe(TRUE));
59-
it(`${TRUE_EXPECTATION}`, () => expect(isPrimitive(FALSE_INSTANCE, 'boolean')).toBe(TRUE));
38+
it(`${TRUE_EXPECTATION}`, () => expect(isPrimitive(TRUE_INSTANCE, 'boolean')).toBe(TRUE));
39+
it(`${FALSE_EXPECTATION}`, () => expect(isPrimitive(FALSE_INSTANCE, 'boolean')).toBe(TRUE));
6040
});
6141

6242
// null

0 commit comments

Comments
 (0)