From 98fa323b15cc38e325f397dd2e638f75fbf70f8c Mon Sep 17 00:00:00 2001 From: Max Wu Date: Wed, 26 Feb 2020 22:36:13 +0800 Subject: [PATCH] fix (test): update CSP tests for CDN directives and file hash Signed-off-by: Max Wu --- test/csp.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/csp.js b/test/csp.js index 32df2761..3352a199 100644 --- a/test/csp.js +++ b/test/csp.js @@ -49,8 +49,10 @@ describe('Content security policies', function () { csp = mock.reRequire('../lib/csp') assert(!csp.computeDirectives().scriptSrc.includes('https://cdnjs.cloudflare.com')) + assert(!csp.computeDirectives().scriptSrc.includes('https://cdn.jsdelivr.net')) assert(!csp.computeDirectives().scriptSrc.includes('https://cdn.mathjax.org')) assert(!csp.computeDirectives().styleSrc.includes('https://cdnjs.cloudflare.com')) + assert(!csp.computeDirectives().styleSrc.includes('https://cdn.jsdelivr.net')) assert(!csp.computeDirectives().styleSrc.includes('https://fonts.googleapis.com')) assert(!csp.computeDirectives().fontSrc.includes('https://cdnjs.cloudflare.com')) assert(!csp.computeDirectives().fontSrc.includes('https://fonts.gstatic.com')) @@ -119,6 +121,6 @@ describe('Content security policies', function () { it('Unchanged hash for reveal.js speaker notes plugin', function () { const hash = crypto.createHash('sha1') hash.update(fs.readFileSync(path.resolve(__dirname, '../node_modules/reveal.js/plugin/notes/notes.html'), 'utf8'), 'utf8') - assert.strictEqual(hash.digest('hex'), '471f3826880fac884a4a14faabc492bc854ae994') + assert.strictEqual(hash.digest('hex'), 'd5d872ae49b5db27f638b152e6e528837204d380') }) })