From 596db0d78a19d70ed9d8667acb49d9e0f8b3a1e4 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Fri, 25 Jun 2021 14:07:46 +0200 Subject: [PATCH] fix tests --- src/core/server/csp/config.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/server/csp/config.test.ts b/src/core/server/csp/config.test.ts index 02dbca2c740f9..6db93addb7da8 100644 --- a/src/core/server/csp/config.test.ts +++ b/src/core/server/csp/config.test.ts @@ -22,6 +22,7 @@ describe('config.validate()', () => { expect(() => config.schema.validate({ strict: true, + warnLegacyBrowsers: false, script_src: [`'self'`, `unsafe-inline`], }) ).toThrowErrorMatchingInlineSnapshot( @@ -31,6 +32,7 @@ describe('config.validate()', () => { expect(() => config.schema.validate({ strict: true, + warnLegacyBrowsers: false, script_src: [`'self'`, `'unsafe-inline'`], }) ).toThrowErrorMatchingInlineSnapshot( @@ -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"` ); });