|
1 | | -import fakeFloat from './index.js'; |
| 1 | +import float from './index.js'; |
2 | 2 | import test from 'ava'; |
3 | 3 |
|
4 | | -test('fakeFloat return type to be number', t => { |
5 | | - t.is(typeof fakeFloat(), 'number'); |
| 4 | +test('float return type to be number', t => { |
| 5 | + t.is(typeof float(), 'number'); |
6 | 6 | }); |
7 | 7 |
|
8 | | -test('fakeFloat with number min 0 return type to be number', t => { |
9 | | - t.is(typeof fakeFloat(0), 'number'); |
| 8 | +test('float with number min 0 return type to be number', t => { |
| 9 | + t.is(typeof float({min: 0}), 'number'); |
10 | 10 | }); |
11 | 11 |
|
12 | | -test('fakeFloat with number min 0 and max 10 return type to be number', t => { |
13 | | - t.is(typeof fakeFloat(0, 10), 'number'); |
| 12 | +test('float with number min 0 and max 10 return type to be number', t => { |
| 13 | + t.is(typeof float({min: 0, max: 10}), 'number'); |
14 | 14 | }); |
15 | 15 |
|
16 | | -test('fakeFloat with number min 0 and max 10 less than 11', t => { |
17 | | - t.true(fakeFloat(0, 10) < 11); |
| 16 | +test('float with number min 0 and max 10 less than 11', t => { |
| 17 | + t.true(float({min: 0, max: 10}) < 11); |
18 | 18 | }); |
19 | 19 |
|
20 | | -test('fakeFloat with string to thow error on string', t => { |
| 20 | +test('float with string to thow error on string', t => { |
21 | 21 | const error = t.throws(() => { |
22 | | - fakeFloat('string', 'string', 'string') |
| 22 | + float({min: 'string', max: 'string', fixed: 'string'}) |
23 | 23 | }, {instanceOf: TypeError}); |
24 | 24 |
|
25 | 25 | t.is(error.message, 'Expected all arguments to be numbers.'); |
26 | 26 | }); |
27 | 27 |
|
28 | | -test('fakeFloat with min and max to thow error on min > max', t => { |
| 28 | +test('float with min and max to thow error on min > max', t => { |
29 | 29 | const error = t.throws(() => { |
30 | | - fakeFloat(10, 0) |
| 30 | + float({min: 10, max: 0}) |
31 | 31 | }, {instanceOf: TypeError}); |
32 | 32 |
|
33 | 33 | t.is(error.message, 'Min cannot be greater than Max.'); |
|
0 commit comments