Fix test for new default header
Some checks failed
continuous-integration/appveyor/branch AppVeyor build failed

This commit is contained in:
Jonatan Nilsson 2022-05-12 16:42:54 +00:00
parent e7909cc84b
commit 3a0064c563
2 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ t.describe('#constructor', function() {
assert.strictEqual(ctx.headers['Server'], 'Flaska') assert.strictEqual(ctx.headers['Server'], 'Flaska')
assert.strictEqual(ctx.headers['X-Content-Type-Options'], 'nosniff') assert.strictEqual(ctx.headers['X-Content-Type-Options'], 'nosniff')
assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; object-src 'none'; frame-ancestors 'none'`) assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; font-src 'self' data:; object-src 'none'; frame-ancestors 'none'`)
assert.strictEqual(ctx.headers['Cross-Origin-Opener-Policy'], 'same-origin') assert.strictEqual(ctx.headers['Cross-Origin-Opener-Policy'], 'same-origin')
assert.strictEqual(ctx.headers['Cross-Origin-Resource-Policy'], 'same-origin') assert.strictEqual(ctx.headers['Cross-Origin-Resource-Policy'], 'same-origin')
assert.strictEqual(ctx.headers['Cross-Origin-Embedder-Policy'], 'require-corp') assert.strictEqual(ctx.headers['Cross-Origin-Embedder-Policy'], 'require-corp')
@ -143,7 +143,7 @@ t.describe('#_nonce', function() {
let nextNonce = flaska._nonces[flaska._noncesIndex] let nextNonce = flaska._nonces[flaska._noncesIndex]
flaska._before[0](ctx) flaska._before[0](ctx)
assert.strictEqual(ctx.state.nonce, nextNonce) assert.strictEqual(ctx.state.nonce, nextNonce)
assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; object-src 'none'; frame-ancestors 'none'; script-src 'nonce-${ctx.state.nonce}'`) assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; font-src 'self' data:; object-src 'none'; frame-ancestors 'none'; script-src 'nonce-${ctx.state.nonce}'`)
} }
assert.notOk(flaska._nonces[flaska._noncesIndex]) assert.notOk(flaska._nonces[flaska._noncesIndex])
@ -157,7 +157,7 @@ t.describe('#_nonce', function() {
assert.notStrictEqual(ctx.state.nonce, flaska._nonces[i]) assert.notStrictEqual(ctx.state.nonce, flaska._nonces[i])
} }
assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; object-src 'none'; frame-ancestors 'none'; script-src 'nonce-${ctx.state.nonce}'`) assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; font-src 'self' data:; object-src 'none'; frame-ancestors 'none'; script-src 'nonce-${ctx.state.nonce}'`)
}) })
t.test('should have after that regenerates lost hashes', function() { t.test('should have after that regenerates lost hashes', function() {

View file

@ -157,7 +157,7 @@ t.describe('#requestStart()', function() {
assert.strictEqual(ctx.headers['Server'], 'Flaska') assert.strictEqual(ctx.headers['Server'], 'Flaska')
assert.strictEqual(ctx.headers['X-Content-Type-Options'], 'nosniff') assert.strictEqual(ctx.headers['X-Content-Type-Options'], 'nosniff')
assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; object-src 'none'; frame-ancestors 'none'`) assert.strictEqual(ctx.headers['Content-Security-Policy'], `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data: blob:; font-src 'self' data:; object-src 'none'; frame-ancestors 'none'`)
assert.strictEqual(ctx.headers['Cross-Origin-Opener-Policy'], 'same-origin') assert.strictEqual(ctx.headers['Cross-Origin-Opener-Policy'], 'same-origin')
assert.strictEqual(ctx.headers['Cross-Origin-Resource-Policy'], 'same-origin') assert.strictEqual(ctx.headers['Cross-Origin-Resource-Policy'], 'same-origin')
assert.strictEqual(ctx.headers['Cross-Origin-Embedder-Policy'], 'require-corp') assert.strictEqual(ctx.headers['Cross-Origin-Embedder-Policy'], 'require-corp')