Skip to content

Commit

Permalink
feat: add unit tests for parseURL
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomoguiulfo committed Dec 18, 2018
1 parent 1e05f0f commit 507b959
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/unit/network/rest/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict'; // eslint-disable-line

const assert = require('assert');
const constants = require('../../../../lib/constants');
const { parseURL } = require('../../../../lib/network/rest/utils');

describe('parseURL function', () => {
[
{
inputUrl: `${constants.passthroughFileURL}/test`,
expectedKey: 'test',
},
{
inputUrl: `${constants.passthroughFileURL}/test with spaces`,
expectedKey: 'test with spaces',
},
].forEach(testCase => {
const { inputUrl, expectedKey } = testCase;

it(`should return ${expectedKey} with url "${inputUrl}"`,
() => {
const pathInfo = parseURL(inputUrl, true);
assert.strictEqual(pathInfo.key, expectedKey);
});
});
});

0 comments on commit 507b959

Please sign in to comment.