From e2d8d50adffebd57d9bad9c19ebbcb858dc6f111 Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Wed, 22 Aug 2018 23:56:08 +0800 Subject: [PATCH] test: 'clean' in 'ChainedMap' --- 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())); +});