-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(numbers): add toBeLessThanOrEqualTo
- Loading branch information
1 parent
ac66a84
commit c5bc875
Showing
3 changed files
with
97 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
var toBeNumber = require('./toBeNumber'); | ||
|
||
module.exports = toBeLessThanOrEqualTo; | ||
|
||
function toBeLessThanOrEqualTo(otherNumber, actual) { | ||
return toBeNumber(actual) && actual <= otherNumber; | ||
} |
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,13 @@ | ||
'use strict'; | ||
|
||
describe('toBeLessThanOrEqualTo', function () { | ||
it('asserts value is less or equal than a given number', function () { | ||
expect(1).toBeLessThanOrEqualTo(2); | ||
expect(-1).toBeLessThanOrEqualTo(1); | ||
expect(-2).toBeLessThanOrEqualTo(-1); | ||
expect(-2).toBeLessThanOrEqualTo(-2); | ||
expect(NaN).not.toBeLessThanOrEqualTo(0); | ||
expect(2).not.toBeLessThanOrEqualTo(1); | ||
expect(0).not.toBeLessThanOrEqualTo(-1); | ||
}); | ||
}); |