adjusting test to make it work in latest jsDOM versions that don't support arbitrary bytes in a URLs hash anymore

This commit is contained in:
El RIDO 2018-12-24 08:19:58 +01:00
parent 9348cbe2a1
commit 3883e3fb30
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
2 changed files with 8 additions and 6 deletions

View File

@ -243,12 +243,14 @@ describe('Helper', function () {
'returns the URL without query & fragment', 'returns the URL without query & fragment',
jsc.elements(['http', 'https']), jsc.elements(['http', 'https']),
jsc.nearray(common.jscA2zString()), jsc.nearray(common.jscA2zString()),
jsc.array(common.jscA2zString()),
jsc.array(common.jscQueryString()), jsc.array(common.jscQueryString()),
'asciistring', jsc.array(common.jscA2zString()),
function (schema, address, query, fragment) { function (schema, address, path, query, fragment) {
$.PrivateBin.Helper.reset(); $.PrivateBin.Helper.reset();
var expected = schema + '://' + address.join('') + '/', var path = path.join('') + (path.length > 0 ? '/' : ''),
clean = jsdom('', {url: expected + '?' + query.join('') + '#' + fragment}), expected = schema + '://' + address.join('') + '/' + path,
clean = jsdom('', {url: expected + '?' + query.join('') + '#' + fragment.join('')}),
result = $.PrivateBin.Helper.baseUri(); result = $.PrivateBin.Helper.baseUri();
clean(); clean();
return expected === result; return expected === result;

View File

@ -51,7 +51,7 @@ and jsdom-global locally:
```console ```console
$ npm install -g mocha istanbul $ npm install -g mocha istanbul
$ cd PrivateBin/js $ cd PrivateBin/js
$ npm install jsverify jsdom@9 jsdom-global@2 mime-types $ npm install jsverify jsdom@9 jsdom-global@2 mime-types node-webcrypto-ossl
``` ```
Example for Debian and Ubuntu, including steps to allow the current user to Example for Debian and Ubuntu, including steps to allow the current user to
@ -63,7 +63,7 @@ $ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
$ ln -s /usr/bin/nodejs /usr/local/bin/node $ ln -s /usr/bin/nodejs /usr/local/bin/node
$ npm install -g mocha istanbul $ npm install -g mocha istanbul
$ cd PrivateBin/js $ cd PrivateBin/js
$ npm install jsverify jsdom@9 jsdom-global@2 mime-types $ npm install jsverify jsdom@9 jsdom-global@2 mime-types node-webcrypto-ossl
``` ```
To run the tests, just change into the `js` directory and run istanbul: To run the tests, just change into the `js` directory and run istanbul: