mirror of
https://github.com/Kong/insomnia.git
synced 2026-06-03 13:47:23 -04:00
Move insomnia-data models, services, database code, and common utilities into a dedicated workspace package. Update consumers to import from the new package entrypoints and declare workspace dependencies for the extracted package.
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { deconstructQueryStringToParams } from './querystring';
|
|
|
|
describe('querystring', () => {
|
|
describe('deconstructToParams()', () => {
|
|
it('builds from params', () => {
|
|
const str = deconstructQueryStringToParams('foo=bar%3F%3F&hello&hi%20there=bar%3F%3F&=&=val');
|
|
|
|
expect(str).toEqual([
|
|
{ name: 'foo', value: 'bar??' },
|
|
{ name: 'hello', value: '' },
|
|
{ name: 'hi there', value: 'bar??' },
|
|
]);
|
|
});
|
|
it('builds from params with =', () => {
|
|
const str = deconstructQueryStringToParams('foo=bar&1=2=3=4&hi');
|
|
|
|
expect(str).toEqual([
|
|
{ name: 'foo', value: 'bar' },
|
|
{ name: '1', value: '2=3=4' },
|
|
{ name: 'hi', value: '' },
|
|
]);
|
|
});
|
|
|
|
it('builds from params not strict', () => {
|
|
const str = deconstructQueryStringToParams('foo=bar%3F%3F&hello&hi%20there=bar%3F%3F&=&=val', false);
|
|
|
|
expect(str).toEqual([
|
|
{ name: 'foo', value: 'bar??' },
|
|
{ name: 'hello', value: '' },
|
|
{ name: 'hi there', value: 'bar??' },
|
|
{ name: '', value: '' },
|
|
{ name: '', value: 'val' },
|
|
]);
|
|
});
|
|
|
|
it('builds from params with strictNullHandle', () => {
|
|
const str = deconstructQueryStringToParams('foo=bar&foo1&foo2=', true, { strictNullHandling: true });
|
|
|
|
expect(str).toEqual([
|
|
{ name: 'foo', value: 'bar' },
|
|
{ name: 'foo1', value: null },
|
|
{ name: 'foo2', value: '' },
|
|
]);
|
|
});
|
|
});
|
|
});
|