forked from i-voted-for-trump/is-odd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
43 lines (36 loc) · 941 Bytes
/
test.js
File metadata and controls
43 lines (36 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*!
* is-odd <https://github.com/jonschlinkert/is-odd>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
require('mocha');
var assert = require('assert');
var isOdd = require('./');
describe('isOdd', function() {
it('should return true if the number is odd:', function() {
assert(!isOdd(0));
assert(isOdd(1));
assert(!isOdd(2));
assert(isOdd(3));
assert(isOdd(1.0e0));
});
it('should work with strings:', function() {
assert(!isOdd('0'));
assert(isOdd('1'));
assert(!isOdd('2'));
assert(isOdd('3'));
assert(isOdd('1.0e0'));
});
it('should throw an error on bad args:', function() {
assert.throws(function() {
isOdd();
}, /is-odd expects a number\./);
});
it('should throw an error on not-integers:', function() {
assert.throws(function() {
isOdd('1.1e0');
}, /is-odd expects an integer\./);
});
});