test(v2): add more test to normalizeUrl

This commit is contained in:
endiliey 2019-11-26 18:26:55 +07:00
parent 1aff2087b4
commit ceea69df2f

View file

@ -257,9 +257,19 @@ describe('load utils', () => {
input: ['http://foobar.com', '', 'test'],
output: 'http://foobar.com/test',
},
{
input: ['http://foobar.com', '', 'test', '/'],
output: 'http://foobar.com/test/',
},
];
asserts.forEach(testCase => {
expect(normalizeUrl(testCase.input)).toBe(testCase.output);
});
expect(() =>
normalizeUrl(['http:example.com', undefined]),
).toThrowErrorMatchingInlineSnapshot(
`"Url must be a string. Received undefined"`,
);
});
});