mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 12:57:46 +00:00
### Related Issues Updates @types/node to the latest version within the v14 major (based on `npm view @types/node`) ``` ❯ npm view @types/node@'>=14.0.0 <15.0.0' version | tail -1 @types/node@14.18.33 '14.18.33' ``` This PR also fixes the various necessary type changes ### 📋 Checklist <!-- Please keep your PR as a Draft until the checklist is complete --> #### Tests - [ ] The code changed/added as part of this PR has been covered with tests - [ ] All tests pass locally with `yarn test-unit` #### Code Review - [ ] This PR has a concise title and thorough description useful to a reviewer - [ ] Issue from task tracker has a link to this PR
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import {
|
|
parseQueryString,
|
|
formatQueryString,
|
|
} from '../../../../src/util/dev/parse-query-string';
|
|
|
|
describe('parseQueryString', () => {
|
|
it('should parse to Map and format back to original String', async () => {
|
|
const querystring =
|
|
'?a&a=&a&b=1&c=2&c=3&d=&d&d=&space%20bar=4&html=%3Ch1%3E';
|
|
const parsed = parseQueryString(querystring);
|
|
expect(parsed).toEqual({
|
|
a: [undefined, '', undefined],
|
|
b: ['1'],
|
|
c: ['2', '3'],
|
|
d: ['', undefined, ''],
|
|
'space bar': ['4'],
|
|
html: ['<h1>'],
|
|
});
|
|
const format = formatQueryString(parsed);
|
|
expect(format).toEqual(querystring);
|
|
});
|
|
it('should work with empty string', async () => {
|
|
const parsed = parseQueryString('');
|
|
expect(parsed).toEqual({});
|
|
const format = formatQueryString(parsed);
|
|
expect(format).toEqual(null);
|
|
});
|
|
it('should work with question mark', async () => {
|
|
const parsed = parseQueryString('?');
|
|
expect(parsed).toEqual({});
|
|
const format = formatQueryString(parsed);
|
|
expect(format).toEqual(null);
|
|
});
|
|
it('should work without question mark', async () => {
|
|
const parsed = parseQueryString('blarg');
|
|
expect(parsed).toEqual({});
|
|
const format = formatQueryString(parsed);
|
|
expect(format).toEqual(null);
|
|
});
|
|
it('should work with undefined', async () => {
|
|
const parsed = parseQueryString(undefined);
|
|
expect(parsed).toEqual({});
|
|
const format = formatQueryString(parsed);
|
|
expect(format).toEqual(null);
|
|
});
|
|
});
|