Skip to content

Commit

Permalink
test(v2): add protocol relative uri validation test (#3453)
Browse files Browse the repository at this point in the history
* feat(v2): add relative uri support

* add // protocol relative uris test case

Co-authored-by: slorber <lorber.sebastien@gmail.com>
  • Loading branch information
moonrailgun and slorber authored Sep 29, 2020
1 parent fe78cbe commit f802a76
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,24 @@ describe('validation schemas', () => {
});

test('URISchema', () => {
const {testFail, testOK} = createTestHelpers({schema: URISchema});

const validURL = 'https://docusaurus.io';
const doubleHash = 'https://docusaurus.io#github#/:';
const invalidURL = 'spaces are invalid in a URL';
const relativeURL = 'relativeURL';
const relativeURLWithParent = '../relativeURLWithParent';
const urlFromIssue = 'https://riot.im/app/#/room/#ligo-public:matrix.org';
const {testFail, testOK} = createTestHelpers({schema: URISchema});
testOK(validURL);
testOK(doubleHash);
testFail(invalidURL);
testOK(relativeURL);
testOK(relativeURLWithParent);
testOK(urlFromIssue);

const protocolRelativeUrl1 = '//docusaurus.io/path';
const protocolRelativeUrl2 = '//docusaurus.io/docs/doc1#hash';
testOK(protocolRelativeUrl1);
testOK(protocolRelativeUrl2);
});
});

0 comments on commit f802a76

Please sign in to comment.