Skip to content

Commit

Permalink
add arg parser test case
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Oct 19, 2022
1 parent 6509f76 commit 1bc6e81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/helpers/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ test('Test parseMatchProps for working with different url inputs', (assert) => {
const URL_INPUT_3 = '/^https?://example.org/';
const URL_INPUT_4 = '/^https?://example.org/section#user:45/comments/';

const GET_METHOD = 'GET';
const MIXED_INPUT = `url:${URL_INPUT_3} method:${GET_METHOD}`;

assert.ok(parseMatchProps(URL_INPUT_1).url, URL_INPUT_1, 'No url match prop, no protocol, not regexp');
assert.ok(parseMatchProps(`url: ${URL_INPUT_1}`).url, URL_INPUT_1, 'url match prop, no protocol, not regexp');

Expand All @@ -134,4 +137,7 @@ test('Test parseMatchProps for working with different url inputs', (assert) => {

assert.ok(parseMatchProps(URL_INPUT_4).url, URL_INPUT_4, 'No url match prop, has protocol, regexp, extra colon in url');
assert.ok(parseMatchProps(`url: ${URL_INPUT_4}`).url, URL_INPUT_4, 'url match prop, has protocol, extra colon in url');

assert.ok(parseMatchProps(MIXED_INPUT).url, URL_INPUT_3, 'Mixed input, url is parsed correctly');
assert.ok(parseMatchProps(MIXED_INPUT).method, GET_METHOD, 'Mixed input, method is parsed correctly');
});

0 comments on commit 1bc6e81

Please sign in to comment.