import { AxiosRequestConfig } from 'axios'; import { isRelativeUrl } from '../is-relative-url'; describe(isRelativeUrl.name, () => { const subject = (config: AxiosRequestConfig) => isRelativeUrl(config); test.each([ undefined, 'http://www.example.com', 'HTTP://EXAMPLE.COM', 'https://www.example.com/blog/article.html', 'ftp://example.com', '//cdn.example.com/lib.js', 'git+ssh://example.com/item', ])('%s => false', url => { expect(subject({ url })).toBe(false); }); test.each(['', '/test/path.html', 'test'])('"%s" => true', url => { expect(subject({ url })).toBe(true); }); });