Created
January 14, 2018 05:57
-
-
Save davidgilbertson/d0c95fbfbbd447d9c52038ea585ad9da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const { JSDOM } = require('jsdom'); | |
it('should not contain any external scripts, ask David why', () => { | |
const creditCardForm = fs.readFileSync(path.resolve(__dirname, '../public/credit-card-form.html'), 'utf8'); | |
const dom = new JSDOM( | |
creditCardForm, | |
{ runScripts: 'dangerously' }, | |
); | |
const scriptElementWithSource = dom.window.document.querySelector('script[src]'); | |
expect(scriptElementWithSource).toBe(null); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment