-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from sambauers/sambauers/typescript
- Loading branch information
Showing
38 changed files
with
2,882 additions
and
4,181 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/* |
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
38 changes: 6 additions & 32 deletions
38
__tests__/buildCSPHeaders.js → __tests__/buildCSPHeaders.ts
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
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,44 @@ | ||
// Local imports | ||
import crunchCSPHeaderValue from '../src/lib/crunchCSPHeaderValue' | ||
|
||
describe('crunchCSPHeaderValue', () => { | ||
test('with single header', () => { | ||
const crunchedHeaders = crunchCSPHeaderValue({ | ||
'base-uri': 'header-value', | ||
}) | ||
|
||
expect(crunchedHeaders).toEqual('base-uri header-value;') | ||
}) | ||
|
||
test('with multiple headers', () => { | ||
const crunchedHeaders = crunchCSPHeaderValue({ | ||
'base-uri': 'header-value1', | ||
'child-src': 'header-value2', | ||
}) | ||
|
||
expect(crunchedHeaders).toEqual('base-uri header-value1;child-src header-value2;') | ||
}) | ||
|
||
test('with values array', () => { | ||
const crunchedHeaders = crunchCSPHeaderValue({ | ||
'base-uri': [ | ||
'header-value1', | ||
'header-value2', | ||
], | ||
}) | ||
|
||
expect(crunchedHeaders).toEqual('base-uri header-value1 header-value2;') | ||
}) | ||
|
||
test('with mixed value types', () => { | ||
const crunchedHeaders = crunchCSPHeaderValue({ | ||
'base-uri': 'header-value1', | ||
'child-src': [ | ||
'header-value2', | ||
'header-value3', | ||
], | ||
}) | ||
|
||
expect(crunchedHeaders).toEqual('base-uri header-value1;child-src header-value2 header-value3;') | ||
}) | ||
}) |
6 changes: 1 addition & 5 deletions
6
__tests__/crunchFeaturePolicyHeader.js → __tests__/crunchFeaturePolicyHeader.ts
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 was deleted.
Oops, something went wrong.
6 changes: 1 addition & 5 deletions
6
__tests__/crunchPermissionsPolicyHeader.js → __tests__/crunchPermissionsPolicyHeader.ts
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.