From 04eebb96cd02a1d88ff1aab707c9f8ebc9580305 Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Thu, 23 Aug 2018 05:27:08 +0800 Subject: [PATCH] test: 'clean' in 'ChainedMap' (#93) --- test/ChainedMap.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/ChainedMap.js b/test/ChainedMap.js index 07558a8..f576a0e 100644 --- a/test/ChainedMap.js +++ b/test/ChainedMap.js @@ -164,3 +164,26 @@ test('when false', t => { t.false(map.has('alpha')); t.true(map.has('beta')); }); + +test('clean undefined', t => { + const map = new ChainedMap(); + map.set('alpha', undefined); + map.set('beta', 'b'); + t.true('alpha' in map.entries()); + t.false('alpha' in map.clean(map.entries())); + t.true('beta' in map.clean(map.entries())); +}); + +test('clean empty array', t => { + const map = new ChainedMap(); + map.set('alpha', []); + t.true('alpha' in map.entries()); + t.false('alpha' in map.clean(map.entries())); +}); + +test('clean empty object', t => { + const map = new ChainedMap(); + map.set('alpha', {}); + t.true('alpha' in map.entries()); + t.false('alpha' in map.clean(map.entries())); +});