mirror of
https://github.com/axios/axios.git
synced 2026-04-11 14:21:59 +08:00
* chore: small fixes to tests * feat: transitional move to vitests * feat: moving unit tests in progress * feat: moving more unit tests over * feat: more tests moved * feat: updated more sections of the http test * chore: wip http tests * chore: wip http tests * chore: more http tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: remove un-needed docs * chore: update package lock * chore: update lock
29 lines
977 B
JavaScript
29 lines
977 B
JavaScript
import { describe, it } from 'vitest';
|
|
import assert from 'assert';
|
|
import utils from '../../lib/utils.js';
|
|
import parseProtocol from '../../lib/helpers/parseProtocol.js';
|
|
|
|
describe('helpers::parseProtocol', () => {
|
|
it('should parse protocol part if it exists', () => {
|
|
utils.forEach(
|
|
{
|
|
'http://username:password@example.com/': 'http',
|
|
'ftp:google.com': 'ftp',
|
|
'sms:+15105550101?body=hello%20there': 'sms',
|
|
'tel:0123456789': 'tel',
|
|
'//google.com': '',
|
|
'google.com': '',
|
|
'admin://etc/default/grub': 'admin',
|
|
'stratum+tcp://server:port': 'stratum+tcp',
|
|
'/api/resource:customVerb': '',
|
|
'https://stackoverflow.com/questions/': 'https',
|
|
'mailto:jsmith@example.com': 'mailto',
|
|
'chrome-extension://1234/<pageName>.html': 'chrome-extension',
|
|
},
|
|
(expectedProtocol, url) => {
|
|
assert.strictEqual(parseProtocol(url), expectedProtocol);
|
|
}
|
|
);
|
|
});
|
|
});
|