11// Function.
22import { guardObjectKey } from '../lib/guard-object-key.func' ;
33// Variables.
4- import { CLASS } from './variables/class.const' ;
4+ import { CLASS , TEST_CLASS , TestClass } from './variables/class.const' ;
55import { NUMBER } from './variables/number.const' ;
66import { OBJECT_ONE } from './variables/object.const' ;
77import { SYMBOL_NUMBER , SYMBOL_STRING } from './variables/symbol.const' ;
8- import { TRUE } from './variables/boolean.const' ;
8+ import { TRUE , FALSE } from './variables/boolean.const' ;
99
1010describe ( guardObjectKey . name , ( ) => {
1111 // Defined.
1212 it ( 'is DEFINED' , ( ) => expect ( guardObjectKey ) . toBeDefined ( ) ) ;
1313
1414 // Checks ...
1515 describe ( `checks` , ( ) => {
16- // it('callback', () => {
17- // guardObjectKey(CLASS , ['firstName', 'surname'], (result: boolean, value: Class ) => {
18- // expect(result).toBe(TRUE);
19- // expect(value).toEqual(CLASS);
20- // return result;
21- // });
22- // });
16+ it ( 'callback' , ( ) => {
17+ guardObjectKey < TestClass > ( TEST_CLASS , [ 'firstName' , 'surname' ] , ( result : boolean , value : TestClass ) => {
18+ expect ( result ) . toBe ( TRUE ) ;
19+ expect ( value ) . toEqual ( CLASS ) ;
20+ return result ;
21+ } ) ;
22+ } ) ;
2323
2424 // ... instance.
2525 describe ( `instance` , ( ) => {
@@ -30,15 +30,15 @@ describe(guardObjectKey.name , () => {
3030 expect ( guardObjectKey ( CLASS , 5 ) ) . toBe ( TRUE ) ;
3131 } ) ;
3232
33- it ( 'finds getter number' , ( ) => expect ( guardObjectKey ( CLASS , NUMBER ) ) . toBe ( TRUE ) ) ;
33+ it ( 'finds getter number' , ( ) => expect ( guardObjectKey ( CLASS , NUMBER ) ) . toBe ( FALSE ) ) ;
3434
3535 // string.
3636 it ( 'has string key' , ( ) => expect ( guardObjectKey ( CLASS , 'surname' ) ) . toBe ( TRUE ) ) ;
3737
3838 // symbol.
3939 it ( 'finds getter symbol key' , ( ) => {
40- expect ( guardObjectKey ( CLASS , SYMBOL_NUMBER ) ) . toBe ( TRUE ) ;
41- expect ( guardObjectKey ( CLASS , SYMBOL_STRING ) ) . toBe ( TRUE ) ;
40+ expect ( guardObjectKey ( CLASS , SYMBOL_NUMBER ) ) . toBe ( FALSE ) ;
41+ expect ( guardObjectKey ( CLASS , SYMBOL_STRING ) ) . toBe ( FALSE ) ;
4242 } ) ;
4343 } ) ;
4444 } ) ;
0 commit comments