summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/test/css-head-mdx.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/css-head-mdx.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/css-head-mdx.test.js')
-rw-r--r--packages/integrations/mdx/test/css-head-mdx.test.js27
1 files changed, 14 insertions, 13 deletions
diff --git a/packages/integrations/mdx/test/css-head-mdx.test.js b/packages/integrations/mdx/test/css-head-mdx.test.js
index ed1c6d1d6..8b5764625 100644
--- a/packages/integrations/mdx/test/css-head-mdx.test.js
+++ b/packages/integrations/mdx/test/css-head-mdx.test.js
@@ -1,7 +1,8 @@
import mdx from '@astrojs/mdx';
-import { expect } from 'chai';
import { parseHTML } from 'linkedom';
+import { describe, it, before } from 'node:test';
+import * as assert from 'node:assert/strict';
import { loadFixture } from '../../../astro/test/test-utils.js';
import * as cheerio from 'cheerio';
@@ -27,10 +28,10 @@ describe('Head injection w/ MDX', () => {
const { document } = parseHTML(html);
const links = document.querySelectorAll('head link[rel=stylesheet]');
- expect(links).to.have.a.lengthOf(1);
+ assert.equal(links.length, 1);
const scripts = document.querySelectorAll('head script[type=module]');
- expect(scripts).to.have.a.lengthOf(1);
+ assert.equal(scripts.length, 1);
});
it('injects into the head for content collections', async () => {
@@ -38,7 +39,7 @@ describe('Head injection w/ MDX', () => {
const { document } = parseHTML(html);
const links = document.querySelectorAll('head link[rel=stylesheet]');
- expect(links).to.have.a.lengthOf(1);
+ assert.equal(links.length, 1);
});
it('injects content from a component using Content#render()', async () => {
@@ -46,10 +47,10 @@ describe('Head injection w/ MDX', () => {
const { document } = parseHTML(html);
const links = document.querySelectorAll('head link[rel=stylesheet]');
- expect(links).to.have.a.lengthOf(1);
+ assert.equal(links.length, 1);
const scripts = document.querySelectorAll('head script[type=module]');
- expect(scripts).to.have.a.lengthOf(2);
+ assert.equal(scripts.length, 2);
});
it('Using component using slots.render() API', async () => {
@@ -57,7 +58,7 @@ describe('Head injection w/ MDX', () => {
const { document } = parseHTML(html);
const links = document.querySelectorAll('head link[rel=stylesheet]');
- expect(links).to.have.a.lengthOf(1);
+ assert.equal(links.length, 1);
});
it('Using component but no layout', async () => {
@@ -66,10 +67,10 @@ describe('Head injection w/ MDX', () => {
const $ = cheerio.load(html);
const headLinks = $('head link[rel=stylesheet]');
- expect(headLinks).to.have.a.lengthOf(1);
+ assert.equal(headLinks.length, 1);
const bodyLinks = $('body link[rel=stylesheet]');
- expect(bodyLinks).to.have.a.lengthOf(0);
+ assert.equal(bodyLinks.length, 0);
});
it('JSX component rendering Astro children within head buffering phase', async () => {
@@ -78,10 +79,10 @@ describe('Head injection w/ MDX', () => {
const $ = cheerio.load(html);
const headLinks = $('head link[rel=stylesheet]');
- expect(headLinks).to.have.a.lengthOf(1);
+ assert.equal(headLinks.length, 1);
const bodyLinks = $('body link[rel=stylesheet]');
- expect(bodyLinks).to.have.a.lengthOf(0);
+ assert.equal(bodyLinks.length, 0);
});
it('Injection caused by delayed slots', async () => {
@@ -91,10 +92,10 @@ describe('Head injection w/ MDX', () => {
const $ = cheerio.load(html);
const headLinks = $('head link[rel=stylesheet]');
- expect(headLinks).to.have.a.lengthOf(1);
+ assert.equal(headLinks.length, 1);
const bodyLinks = $('body link[rel=stylesheet]');
- expect(bodyLinks).to.have.a.lengthOf(0);
+ assert.equal(bodyLinks.length, 0);
});
});
});