Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Jun 25, 2021
1 parent 46681a3 commit 596db0d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/server/csp/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('config.validate()', () => {
expect(() =>
config.schema.validate({
strict: true,
warnLegacyBrowsers: false,
script_src: [`'self'`, `unsafe-inline`],
})
).toThrowErrorMatchingInlineSnapshot(
Expand All @@ -31,6 +32,7 @@ describe('config.validate()', () => {
expect(() =>
config.schema.validate({
strict: true,
warnLegacyBrowsers: false,
script_src: [`'self'`, `'unsafe-inline'`],
})
).toThrowErrorMatchingInlineSnapshot(
Expand All @@ -41,20 +43,22 @@ describe('config.validate()', () => {
it(`throws if containing 'unsafe-inline' when 'warnLegacyBrowsers' is true`, () => {
expect(() =>
config.schema.validate({
strict: false,
warnLegacyBrowsers: true,
script_src: [`'self'`, `unsafe-inline`],
})
).toThrowErrorMatchingInlineSnapshot(
`"cannot use \`unsafe-inline\` for \`script_src\` when \`csp.strict\` is true"`
`"cannot use \`unsafe-inline\` for \`script_src\` when \`csp.warnLegacyBrowsers\` is true"`
);

expect(() =>
config.schema.validate({
strict: false,
warnLegacyBrowsers: true,
script_src: [`'self'`, `'unsafe-inline'`],
})
).toThrowErrorMatchingInlineSnapshot(
`"cannot use \`unsafe-inline\` for \`script_src\` when \`csp.strict\` is true"`
`"cannot use \`unsafe-inline\` for \`script_src\` when \`csp.warnLegacyBrowsers\` is true"`
);
});

Expand Down

0 comments on commit 596db0d

Please sign in to comment.