-
-
Notifications
You must be signed in to change notification settings - Fork 797
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a9aed3
commit 87b5357
Showing
6 changed files
with
154 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
'use strict' | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
require('@babel/register') | ||
|
||
module.exports = { | ||
runner: 'jest-light-runner', | ||
// Ignore 'tests' directory as it contains all the integration tests | ||
modulePathIgnorePatterns: ['src/lambda/__tests__/fixtures/', 'tests/'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
144 changes: 1 addition & 143 deletions
144
src/utils/__tests__/parseMultiValueQueryStringParameters.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
src/utils/__tests__/tests/parseQueryStringParameters.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
export default [ | ||
{ | ||
description: 'no parameter (empty string)', | ||
expected: null, | ||
expectedMulti: null, | ||
param: '', | ||
}, | ||
|
||
{ | ||
description: 'string parameter', | ||
expected: { foo: 'bar' }, | ||
expectedMulti: { foo: ['bar'] }, | ||
param: 'foo=bar', | ||
}, | ||
|
||
{ | ||
description: 'number parameter (no type casting)', | ||
expected: { foo: '1' }, | ||
expectedMulti: { foo: ['1'] }, | ||
param: 'foo=1', | ||
}, | ||
|
||
{ | ||
description: 'boolean parameter (no type casting)', | ||
expected: { foo: 'true' }, | ||
expectedMulti: { foo: ['true'] }, | ||
param: 'foo=true', | ||
}, | ||
|
||
{ | ||
description: 'multiple parameters', | ||
expected: { bar: 'test2', foo: 'test1' }, | ||
expectedMulti: { bar: ['test2'], foo: ['test1'] }, | ||
param: 'foo=test1&bar=test2', | ||
}, | ||
|
||
{ | ||
description: 'multiple parameters, same keys', | ||
expected: { foo: 'foobar' }, | ||
expectedMulti: { foo: ['test', 'foobar'] }, | ||
param: 'foo=test&foo=foobar', | ||
}, | ||
|
||
{ | ||
description: 'multiple parameters, same keys, different casing', | ||
expected: { foo: 'test', FOO: 'FOOBAR' }, | ||
expectedMulti: { foo: ['test'], FOO: ['FOOBAR'] }, | ||
param: 'foo=test&FOO=FOOBAR', | ||
}, | ||
|
||
{ | ||
description: 'multiple parameters, same keys, same values', | ||
expected: { foo: 'test' }, | ||
expectedMulti: { foo: ['test', 'test'] }, | ||
param: 'foo=test&foo=test', | ||
}, | ||
|
||
{ | ||
description: 'no value', | ||
expected: { foo: '' }, | ||
expectedMulti: { foo: [''] }, | ||
param: 'foo', | ||
}, | ||
|
||
{ | ||
description: 'no value with =', | ||
expected: { foo: '' }, | ||
expectedMulti: { foo: [''] }, | ||
param: 'foo=', | ||
}, | ||
|
||
{ | ||
description: 'no value with &', | ||
expected: { foo: '' }, | ||
expectedMulti: { foo: [''] }, | ||
param: 'foo&', | ||
}, | ||
|
||
{ | ||
description: 'no value with = and &', | ||
expected: { foo: '' }, | ||
expectedMulti: { foo: [''] }, | ||
param: 'foo=&', | ||
}, | ||
|
||
{ | ||
description: 'value is whitespace', | ||
expected: { foo: ' ' }, | ||
expectedMulti: { foo: [' '] }, | ||
param: 'foo=%20', | ||
}, | ||
|
||
{ | ||
description: 'key and value have whitespace', | ||
expected: { ' foo ': ' test ' }, | ||
expectedMulti: { ' foo ': [' test '] }, | ||
param: '%20foo%20=%20test%20', | ||
}, | ||
|
||
{ | ||
description: 'unicode', | ||
expected: { Σ: '😋' }, | ||
expectedMulti: { Σ: ['😋'] }, | ||
param: 'Σ=😋', | ||
}, | ||
|
||
{ | ||
description: 'encoded', // encodeURIComponent | ||
expected: { '?=/&:': '?=/&:' }, | ||
expectedMulti: { '?=/&:': ['?=/&:'] }, | ||
param: '%3F%3D%2F%26%3A=%3F%3D%2F%26%3A', | ||
}, | ||
|
||
{ | ||
description: 'end of line', | ||
expected: { '\n': '\n' }, | ||
expectedMulti: { '\n': ['\n'] }, | ||
param: '%0A=%0A', | ||
}, | ||
|
||
// silly test section: | ||
{ | ||
description: 'silly I.', | ||
expected: { test: '?' }, | ||
expectedMulti: { test: ['?'] }, | ||
param: 'test=?', | ||
}, | ||
|
||
{ | ||
description: 'silly II.', | ||
expected: { test: '/' }, | ||
expectedMulti: { test: ['/'] }, | ||
param: 'test=/', | ||
}, | ||
|
||
{ | ||
description: 'silly III.', | ||
expected: { test: '=' }, | ||
expectedMulti: { test: ['='] }, | ||
param: 'test==', | ||
}, | ||
] |