From 11d5e52710def26b4fd8dcff503c9ff4b87f6f5a Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Wed, 31 Jan 2024 21:37:34 +1300 Subject: migrate MDX tests (#9894) --- .../mdx/test/mdx-script-style-raw.test.js | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'packages/integrations/mdx/test/mdx-script-style-raw.test.js') 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' ); }); -- cgit v1.2.3