summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
diff options
context:
space:
mode:
authorGravatar Alex Nguyen <dev@alexnguyen.co.nz> 2024-01-31 21:37:34 +1300
committerGravatar GitHub <noreply@github.com> 2024-01-31 08:37:34 +0000
commit11d5e52710def26b4fd8dcff503c9ff4b87f6f5a (patch)
treeb874374356553bd2e2023334aa540e4437fffc69 /packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
parent6dbafb8f5f34d54124a564f70b1cc3d152855bf2 (diff)
downloadastro-11d5e52710def26b4fd8dcff503c9ff4b87f6f5a.tar.gz
astro-11d5e52710def26b4fd8dcff503c9ff4b87f6f5a.tar.zst
astro-11d5e52710def26b4fd8dcff503c9ff4b87f6f5a.zip
migrate MDX tests (#9894)
Diffstat (limited to 'packages/integrations/mdx/test/mdx-syntax-highlighting.test.js')
-rw-r--r--packages/integrations/mdx/test/mdx-syntax-highlighting.test.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
index 40281cffd..e5ce04126 100644
--- a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
+++ b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
@@ -1,6 +1,7 @@
import mdx from '@astrojs/mdx';
-import { expect } from 'chai';
+import { describe, it } from 'node:test';
+import * as assert from 'node:assert/strict';
import { parseHTML } from 'linkedom';
import { loadFixture } from '../../../astro/test/test-utils.js';
import shikiTwoslash from 'remark-shiki-twoslash';
@@ -24,8 +25,8 @@ describe('MDX syntax highlighting', () => {
const { document } = parseHTML(html);
const shikiCodeBlock = document.querySelector('pre.astro-code');
- expect(shikiCodeBlock).to.not.be.null;
- expect(shikiCodeBlock.getAttribute('style')).to.contain('background-color:#24292e');
+ assert.notEqual(shikiCodeBlock, null);
+ assert.equal(shikiCodeBlock.getAttribute('style').includes('background-color:#24292e'), true);
});
it('respects markdown.shikiConfig.theme', async () => {
@@ -45,8 +46,8 @@ describe('MDX syntax highlighting', () => {
const { document } = parseHTML(html);
const shikiCodeBlock = document.querySelector('pre.astro-code');
- expect(shikiCodeBlock).to.not.be.null;
- expect(shikiCodeBlock.getAttribute('style')).to.contain('background-color:#282A36');
+ assert.notEqual(shikiCodeBlock, null);
+ assert.equal(shikiCodeBlock.getAttribute('style').includes('background-color:#282A36'), true);
});
});
@@ -65,7 +66,7 @@ describe('MDX syntax highlighting', () => {
const { document } = parseHTML(html);
const prismCodeBlock = document.querySelector('pre.language-astro');
- expect(prismCodeBlock).to.not.be.null;
+ assert.notEqual(prismCodeBlock, null);
});
for (const extendMarkdownConfig of [true, false]) {
@@ -88,9 +89,9 @@ describe('MDX syntax highlighting', () => {
const { document } = parseHTML(html);
const shikiCodeBlock = document.querySelector('pre.astro-code');
- expect(shikiCodeBlock, 'Markdown config syntaxHighlight used unexpectedly').to.be.null;
+ assert.equal(shikiCodeBlock, null, 'Markdown config syntaxHighlight used unexpectedly');
const prismCodeBlock = document.querySelector('pre.language-astro');
- expect(prismCodeBlock).to.not.be.null;
+ assert.notEqual(prismCodeBlock, null);
});
}
});
@@ -113,7 +114,7 @@ describe('MDX syntax highlighting', () => {
const { document } = parseHTML(html);
const twoslashCodeBlock = document.querySelector('pre.shiki');
- expect(twoslashCodeBlock).to.not.be.null;
+ assert.notEqual(twoslashCodeBlock, null);
});
it('supports custom highlighter - rehype-pretty-code', async () => {
@@ -140,6 +141,6 @@ describe('MDX syntax highlighting', () => {
await fixture.build();
const html = await fixture.readFile('/index.html');
- expect(html).to.include('style="background-color:#000000"');
+ assert.equal(html.includes('style="background-color:#000000"'), true);
});
});