File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ const myLodash = require ( '../../api/utils/myLodash' ) ;
2+
3+ describe ( 'myLodash >' , ( ) => {
4+ describe ( 'objectIsEmpty >' , ( ) => {
5+ describe ( 'when receives an filled object' , ( ) => {
6+ it ( 'should return false' , ( ) => {
7+ const objectIsEmpty = myLodash . objectIsEmpty ( { lorem : 'ipsum' } ) ;
8+
9+ expect ( objectIsEmpty ) . toBeFalsy ( ) ;
10+ expect . assertions ( 1 ) ;
11+ } ) ;
12+ } ) ;
13+
14+ describe ( 'when receives an empty object' , ( ) => {
15+ it ( 'should return true' , ( ) => {
16+ const objectIsEmpty = myLodash . objectIsEmpty ( { } ) ;
17+
18+ expect ( objectIsEmpty ) . toBeTruthy ( ) ;
19+ expect . assertions ( 1 ) ;
20+ } ) ;
21+ } ) ;
22+
23+ describe ( 'when receives anything that arent a object' , ( ) => {
24+ it ( 'should do nothing' , ( ) => {
25+ const objectIsEmpty = myLodash . objectIsEmpty ( 'foobar' ) ;
26+
27+ expect ( objectIsEmpty ) . toBeUndefined ( ) ;
28+ expect . assertions ( 1 ) ;
29+ } ) ;
30+ } ) ;
31+ } ) ;
32+ } ) ;
Original file line number Diff line number Diff line change 11module . exports . objectIsEmpty = ( object ) => {
2+ if ( typeof object != 'object' ) return ;
23 return Object . keys ( object ) . length === 0
34}
You can’t perform that action at this time.
0 commit comments