From 600231e75236c0b2c1ca6d353182145a4575a0fd Mon Sep 17 00:00:00 2001 From: Christian Mayer Date: Thu, 9 Nov 2023 14:23:32 +0100 Subject: [PATCH] Add unit test f. toQueryString function in UrlUtil --- tests/unit/specs/util/Url.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/unit/specs/util/Url.spec.js b/tests/unit/specs/util/Url.spec.js index 4e0f5364..31af0d75 100644 --- a/tests/unit/specs/util/Url.spec.js +++ b/tests/unit/specs/util/Url.spec.js @@ -39,4 +39,20 @@ describe('UrlUtil', () => { const paramVal = UrlUtil.getQueryParam('foo'); expect(paramVal).to.equal(undefined); }); + + it('toQueryString returns correct query string', () => { + const params = { + foo: 'bar', + kalle: 0, + ralle: 8.88, + bully: true, + nullinger: null, + obj: { + sub1: 1 + } + }; + const queryString = UrlUtil.toQueryString(params); + console.log(queryString); + expect(queryString).to.eql('foo=bar&kalle=0&ralle=8.88&bully=true&sub1=1'); + }); });