Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
vejja committed May 7, 2024
1 parent 77f3d1b commit 18c7ead
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/ssgHashes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,15 @@ describe('[nuxt-security] SSG support of CSP', async () => {
const metaFrameAncestors = metaCsp!.split(';').find(policy => policy.trim().startsWith('frame-ancestors'))
expect(metaFrameAncestors).toBeUndefined()
})

it('sets CSP meta at top of head after charset meta', async () => {
const res = await fetch('/')

const body = await res.text()

expect(res).toBeDefined()
expect(res).toBeTruthy()
expect(body).toBeDefined()
expect(body).toMatch(/^<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy"/)
})
})

0 comments on commit 18c7ead

Please sign in to comment.