From edee6e4d82f42e59c485271f5f1ad29b3363eb07 Mon Sep 17 00:00:00 2001 From: Brian Mullan Date: Fri, 5 Oct 2018 00:30:46 +0100 Subject: [PATCH] fix: usage of let, 1 test -> 2 separate tests --- test/querystring-implementation.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/test/querystring-implementation.js b/test/querystring-implementation.js index 0636e84..e3eb6d7 100644 --- a/test/querystring-implementation.js +++ b/test/querystring-implementation.js @@ -303,7 +303,7 @@ test('real life example', t => { }); test('it should parse with space insensitivity', t => { - t.plan(5); + t.plan(4); const source = { meh: 'to be trimed', @@ -318,15 +318,33 @@ test('it should parse with space insensitivity', t => { } }; const queries = ['{a}', '{ a}', '{a }', '{ a }']; - let expected = { a: 'a' }; + const expected = { a: 'a' }; + for (const query of queries) { const actual = objectql(source, query); t.deepEqual(actual, expected); } +}); + +test('it should parse with space insensitivity in a deep object query', t => { + t.plan(1); + + const source = { + meh: 'to be trimed', + a: 'a', + b: { + meh: 'to be trimed', + c: 'c', + d: { + meh: 'to be trimed', + e: 'e' + } + } + }; const query = '{a b{ c d { e }} }'; const actual = objectql(source, query); - expected = { + const expected = { a: 'a', b: { c: 'c',