Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a13e860
commit a424282
Showing
5 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function isNull(value) { | ||
return value === null; | ||
} | ||
|
||
isNull.negativeForm = 'isNotNull'; | ||
|
||
export default isNull; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import isNull from '.'; | ||
|
||
describe('Tests isNull rule', () => { | ||
it('Should return true for `null` value', () => { | ||
expect(isNull(null)).toBe(true); | ||
}); | ||
|
||
it.each([ | ||
undefined, | ||
NaN, | ||
false, | ||
true, | ||
Object, | ||
Array(0), | ||
'', | ||
' ', | ||
0, | ||
1, | ||
'0', | ||
'1', | ||
() => {}, | ||
])('Should return false for %s value', v => { | ||
expect(isNull(v)).toBe(false); | ||
}); | ||
|
||
it('Should expose negativeForm property', () => { | ||
expect(isNull.negativeForm).toBe('isNotNull'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters