-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
73 lines (63 loc) · 1.64 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'use strict';
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _assert = require('assert');
var _assert2 = _interopRequireDefault(_assert);
var _index = require('./index');
var _index2 = _interopRequireDefault(_index);
describe('redux-localstorage-slicer', function () {
it('handles undefined persist', function () {
var state = {
fooState: {
bar: 'bar'
}
};
_assert2['default'].deepEqual((0, _index2['default'])()()(state), {});
});
it('handles persist is true', function () {
var state = {
fooState: {
__persist: true,
bar: 'bar',
foo: 'foo'
}
};
_assert2['default'].deepEqual((0, _index2['default'])()()(state), {
fooState: {
__persist: true,
bar: 'bar',
foo: 'foo'
}
});
});
it('handles persist is function', function () {
var state = {
fooState: {
__persist: function __persist(state) {
delete state.foo;
return state;
},
bar: 'bar',
foo: 'foo'
}
};
var slicedState = (0, _index2['default'])()()(state);
_assert2['default'].ok(slicedState.fooState.bar);
_assert2['default'].ok(!slicedState.fooState.foo);
_assert2['default'].ok(slicedState.fooState.__persist);
});
it('handles persist is array', function () {
var state = {
fooState: {
__persist: ['foo'],
bar: 'bar',
foo: 'foo'
}
};
_assert2['default'].deepEqual((0, _index2['default'])()()(state), {
fooState: {
__persist: ['foo'],
foo: 'foo'
}
});
});
});