import { expect } from 'chai' import { rewriteHtmlJs } from '../../lib/html' import snapshot from 'snap-shot-it' import { testHtml } from '../fixtures' const URL = 'http://example.com/foo.html' const rewriteNoSourceMap = (html) => rewriteHtmlJs(URL, html) describe('html rewriter', function () { context('.rewriteHtmlJs', function () { // https://github.com/cypress-io/cypress/issues/2393 it('strips SRI', async function () { snapshot(await rewriteNoSourceMap('')) // should preserve namespaced attrs and still rewrite if no `type` snapshot(await rewriteNoSourceMap('')) }) it('rewrites inline JS with type', async function () { snapshot(await rewriteNoSourceMap('')) }) it('does not rewrite non-JS inline', async function () { snapshot(await rewriteNoSourceMap('')) }) it('ignores invalid inline JS', async function () { const str = '' expect(await rewriteHtmlJs(URL, str)).to.eq(str) }) it('rewrites extra long JS string', async function () { snapshot(await rewriteNoSourceMap('')) }) }) }) })