Skip to content

Commit 454cb90

Browse files
committed
Merge branch 'master' of github.com:edy/redux-persist-transform-filter
2 parents d7cb597 + 7be79e5 commit 454cb90

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ describe('redux-persist-transform-filter', () => {
6262
expect(persistFilter(JSON.parse(JSON.stringify(store)), [{ path: 'a', filterFunction: item => item.x }], 'blacklist')).to.deep.equal({a:{'id3':{x:false, b:'bbb'}}, d:'d'});
6363
expect(persistFilter(JSON.parse(JSON.stringify(store)), [{ path: 'a', filterFunction: item => item.b === 'bb' }], 'blacklist')).to.deep.equal({a:{'id1':{x:true, b:'b'}, 'id3':{x:false, b:'bbb'}}, d:'d'});
6464
});
65+
66+
it('should return a subset, given an object that contains a path and a filterFunction to reduce array', () => {
67+
const store = {a:[1,2,3], b:'b'};
68+
expect(persistFilter(JSON.parse(JSON.stringify(store)), [{ path: 'a', filterFunction: () => true }], 'blacklist')).to.deep.equal({a:[], b:'b'});
69+
expect(persistFilter(JSON.parse(JSON.stringify(store)), [{ path: 'a', filterFunction: () => true }], 'blacklist').a.length).to.equal(0);
70+
});
71+
6572
});
6673

6774
describe('createFilter', () => {

0 commit comments

Comments
 (0)