mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-14 17:47:40 +02:00
test(v2): add more test to normalizeUrl
This commit is contained in:
parent
1aff2087b4
commit
ceea69df2f
1 changed files with 10 additions and 0 deletions
|
@ -257,9 +257,19 @@ describe('load utils', () => {
|
||||||
input: ['http://foobar.com', '', 'test'],
|
input: ['http://foobar.com', '', 'test'],
|
||||||
output: 'http://foobar.com/test',
|
output: 'http://foobar.com/test',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
input: ['http://foobar.com', '', 'test', '/'],
|
||||||
|
output: 'http://foobar.com/test/',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
asserts.forEach(testCase => {
|
asserts.forEach(testCase => {
|
||||||
expect(normalizeUrl(testCase.input)).toBe(testCase.output);
|
expect(normalizeUrl(testCase.input)).toBe(testCase.output);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
normalizeUrl(['http:example.com', undefined]),
|
||||||
|
).toThrowErrorMatchingInlineSnapshot(
|
||||||
|
`"Url must be a string. Received undefined"`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue