-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
34 lines (29 loc) · 819 Bytes
/
test.js
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
import test from 'ava';
import Immutable from 'immutable';
import shuffle from './index';
test('not equal after shuffle', t => {
const list = Immutable.fromJS([...Array(10).keys()]);
for (let i = 1000; i >= 0; i--) {
const result = shuffle(list);
t.false(Immutable.is(list, result));
}
});
test('huge list', t => {
const list = Immutable.fromJS([...Array(999999).keys()]);
const result = shuffle(list);
t.false(Immutable.is(list, result));
});
test('empty list', t => {
const list = Immutable.fromJS([]);
t.notThrows(() => {
const result = shuffle(list);
t.true(Immutable.is(list, result));
});
});
test('single element list', t => {
const list = Immutable.fromJS(['1']);
t.notThrows(() => {
const result = shuffle(list);
t.true(Immutable.is(list, result));
});
});