mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-17 06:08:42 +00:00
25 lines
672 B
TypeScript
25 lines
672 B
TypeScript
|
import { describe, expect, it } from 'vitest';
|
||
|
import { UrlBuilder } from '.';
|
||
|
|
||
|
describe('UrlBuilder', () => {
|
||
|
it('basic query parameter', () => {
|
||
|
const result = UrlBuilder('/test', { a: 'b' });
|
||
|
expect(result).toBe('/api/v1/test?a=b');
|
||
|
});
|
||
|
|
||
|
it('multiple query parameters', () => {
|
||
|
const result = UrlBuilder('/test', { a: 'b', c: 'd' });
|
||
|
expect(result).toBe('/api/v1/test?a=b&c=d');
|
||
|
});
|
||
|
|
||
|
it('no query parameters', () => {
|
||
|
const result = UrlBuilder('/test');
|
||
|
expect(result).toBe('/api/v1/test');
|
||
|
});
|
||
|
|
||
|
it('list-like query parameters', () => {
|
||
|
const result = UrlBuilder('/test', { a: ['b', 'c'] });
|
||
|
expect(result).toBe('/api/v1/test?a=b&a=c');
|
||
|
});
|
||
|
});
|