diff options
author | 2024-01-31 21:37:34 +1300 | |
---|---|---|
committer | 2024-01-31 08:37:34 +0000 | |
commit | 11d5e52710def26b4fd8dcff503c9ff4b87f6f5a (patch) | |
tree | b874374356553bd2e2023334aa540e4437fffc69 /packages/integrations/mdx/test/mdx-script-style-raw.test.js | |
parent | 6dbafb8f5f34d54124a564f70b1cc3d152855bf2 (diff) | |
download | astro-11d5e52710def26b4fd8dcff503c9ff4b87f6f5a.tar.gz astro-11d5e52710def26b4fd8dcff503c9ff4b87f6f5a.tar.zst astro-11d5e52710def26b4fd8dcff503c9ff4b87f6f5a.zip |
migrate MDX tests (#9894)
Diffstat (limited to 'packages/integrations/mdx/test/mdx-script-style-raw.test.js')
-rw-r--r-- | packages/integrations/mdx/test/mdx-script-style-raw.test.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/packages/integrations/mdx/test/mdx-script-style-raw.test.js b/packages/integrations/mdx/test/mdx-script-style-raw.test.js index 99c17ed8d..cac3e7823 100644 --- a/packages/integrations/mdx/test/mdx-script-style-raw.test.js +++ b/packages/integrations/mdx/test/mdx-script-style-raw.test.js @@ -1,5 +1,6 @@ import mdx from '@astrojs/mdx'; -import { expect } from 'chai'; +import { describe, it, before, after } from 'node:test'; +import * as assert from 'node:assert/strict'; import { parseHTML } from 'linkedom'; import { loadFixture } from '../../../astro/test/test-utils.js'; @@ -24,20 +25,22 @@ describe('MDX script style raw', () => { it('works with with raw script and style strings', async () => { const res = await fixture.fetch('/index.html'); - expect(res.status).to.equal(200); + assert.equal(res.status, 200); const html = await res.text(); const { document } = parseHTML(html); const scriptContent = document.getElementById('test-script').innerHTML; - expect(scriptContent).to.include( - "console.log('raw script')", + assert.equal( + scriptContent.includes("console.log('raw script')"), + true, 'script should not be html-escaped' ); const styleContent = document.getElementById('test-style').innerHTML; - expect(styleContent).to.include( - 'h1[id="script-style-raw"]', + assert.equal( + styleContent.includes('h1[id="script-style-raw"]'), + true, 'style should not be html-escaped' ); }); @@ -55,14 +58,16 @@ describe('MDX script style raw', () => { const { document } = parseHTML(html); const scriptContent = document.getElementById('test-script').innerHTML; - expect(scriptContent).to.include( - "console.log('raw script')", + assert.equal( + scriptContent.includes("console.log('raw script')"), + true, 'script should not be html-escaped' ); const styleContent = document.getElementById('test-style').innerHTML; - expect(styleContent).to.include( - 'h1[id="script-style-raw"]', + assert.equal( + styleContent.includes('h1[id="script-style-raw"]'), + true, 'style should not be html-escaped' ); }); |