From 930e111e88f2d0c3f39bc787ceb5d92cbb476ba1 Mon Sep 17 00:00:00 2001 From: leonardosfl Date: Mon, 3 Aug 2020 20:57:24 -0300 Subject: [PATCH] Add test --- test/test-search-utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test-search-utils.js b/test/test-search-utils.js index ffe0f98..a7097f4 100644 --- a/test/test-search-utils.js +++ b/test/test-search-utils.js @@ -40,6 +40,15 @@ describe('search utils', () => { ); }); + it('should allow multiple terms to be used', () => { + const ui = createPreprintQs({ text: ['text1', 'text2'] }); + + assert.equal(ui, '?q=text1&q=text2'); + + const p = querystring.parse(apifyPreprintQs(ui).substring(1)); + assert.equal(p.q, '(name:"text1" OR name:text1* OR name:"text2" OR name:text2*)' ); + }); + it('should handle DOI and arXivId', () => { const ui = createPreprintQs({ text: `text ${arXivId} ${crossrefDoi} ${openAireDoi}`