You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
423 B
TypeScript

import { paramToUrl } from '@/assets/script/util';
describe('util - paramToUrl', () => {
it('when url has not query', () => {
const url = 'https://baidu.com';
expect(paramToUrl(url, { a: 1, b: 2 })).toEqual(`${url}?a=1&b=2`);
});
it('when url has query', () => {
const url = 'https://baidu.com';
expect(paramToUrl(url + '?x=1', { a: 1, b: 2 })).toEqual(`${url}?x=1&a=1&b=2`);
});
});