mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
test(v2): add protocol relative uri validation test (#3453)
* feat(v2): add relative uri support * add // protocol relative uris test case Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
fe78cbeff5
commit
f802a76d83
1 changed files with 7 additions and 1 deletions
|
@ -109,18 +109,24 @@ describe('validation schemas', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('URISchema', () => {
|
test('URISchema', () => {
|
||||||
|
const {testFail, testOK} = createTestHelpers({schema: URISchema});
|
||||||
|
|
||||||
const validURL = 'https://docusaurus.io';
|
const validURL = 'https://docusaurus.io';
|
||||||
const doubleHash = 'https://docusaurus.io#github#/:';
|
const doubleHash = 'https://docusaurus.io#github#/:';
|
||||||
const invalidURL = 'spaces are invalid in a URL';
|
const invalidURL = 'spaces are invalid in a URL';
|
||||||
const relativeURL = 'relativeURL';
|
const relativeURL = 'relativeURL';
|
||||||
const relativeURLWithParent = '../relativeURLWithParent';
|
const relativeURLWithParent = '../relativeURLWithParent';
|
||||||
const urlFromIssue = 'https://riot.im/app/#/room/#ligo-public:matrix.org';
|
const urlFromIssue = 'https://riot.im/app/#/room/#ligo-public:matrix.org';
|
||||||
const {testFail, testOK} = createTestHelpers({schema: URISchema});
|
|
||||||
testOK(validURL);
|
testOK(validURL);
|
||||||
testOK(doubleHash);
|
testOK(doubleHash);
|
||||||
testFail(invalidURL);
|
testFail(invalidURL);
|
||||||
testOK(relativeURL);
|
testOK(relativeURL);
|
||||||
testOK(relativeURLWithParent);
|
testOK(relativeURLWithParent);
|
||||||
testOK(urlFromIssue);
|
testOK(urlFromIssue);
|
||||||
|
|
||||||
|
const protocolRelativeUrl1 = '//docusaurus.io/path';
|
||||||
|
const protocolRelativeUrl2 = '//docusaurus.io/docs/doc1#hash';
|
||||||
|
testOK(protocolRelativeUrl1);
|
||||||
|
testOK(protocolRelativeUrl2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue