Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

// @flow strict-local
import assert from 'assert';
import urlJoin from '../src/urlJoin';
describe('urlJoin', () => {
it('Should join two paths', () => {
let joinedUrl = urlJoin('/', './image.jpeg?test=test');
assert.equal(joinedUrl, '/image.jpeg?test=test');
});
it('Should join two paths with longer publicUrl', () => {
let joinedUrl = urlJoin('/static', './image.jpeg?test=test');
assert.equal(joinedUrl, '/static/image.jpeg?test=test');
});
it('Should join two paths with longer publicUrl', () => {
let joinedUrl = urlJoin('/static', 'image.jpeg?test=test');
assert.equal(joinedUrl, '/static/image.jpeg?test=test');
});
it('Should turn windows path into posix', () => {
let joinedUrl = urlJoin('/static', '.\\image.jpeg?test=test');
assert.equal(joinedUrl, '/static/image.jpeg?test=test');
});
it('should support paths with colons', () => {
let joinedUrl = urlJoin('/static', 'a:b:c.html');
assert.equal(joinedUrl, '/static/a:b:c.html');
joinedUrl = urlJoin('/static', '/a:b:c.html');
assert.equal(joinedUrl, '/static/a:b:c.html');
joinedUrl = urlJoin('/static', './a:b:c.html');
assert.equal(joinedUrl, '/static/a:b:c.html');
});
});