summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/test/mdx-images.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/mdx/test/mdx-images.test.js')
-rw-r--r--packages/integrations/mdx/test/mdx-images.test.js27
1 files changed, 14 insertions, 13 deletions
diff --git a/packages/integrations/mdx/test/mdx-images.test.js b/packages/integrations/mdx/test/mdx-images.test.js
index 950b54581..e070f2358 100644
--- a/packages/integrations/mdx/test/mdx-images.test.js
+++ b/packages/integrations/mdx/test/mdx-images.test.js
@@ -1,4 +1,5 @@
-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';
@@ -22,41 +23,41 @@ describe('MDX Page', () => {
describe('Optimized images in MDX', () => {
it('works', async () => {
const res = await fixture.fetch('/');
- expect(res.status).to.equal(200);
+ assert.equal(res.status, 200);
const html = await res.text();
const { document } = parseHTML(html);
const imgs = document.getElementsByTagName('img');
- expect(imgs.length).to.equal(4);
+ assert.equal(imgs.length, 4);
// Image using a relative path
- expect(imgs.item(0).src.startsWith('/_image')).to.be.true;
+ assert.equal(imgs.item(0).src.startsWith('/_image'), true);
// Image using an aliased path
- expect(imgs.item(1).src.startsWith('/_image')).to.be.true;
+ assert.equal(imgs.item(1).src.startsWith('/_image'), true);
// Image with title
- expect(imgs.item(2).title).to.equal('Houston title');
+ assert.equal(imgs.item(2).title, 'Houston title');
// Image with spaces in the path
- expect(imgs.item(3).src.startsWith('/_image')).to.be.true;
+ assert.equal(imgs.item(3).src.startsWith('/_image'), true);
});
for (const route of imageTestRoutes) {
it(`supports img component - ${route}`, async () => {
const res = await fixture.fetch(`/${route}`);
- expect(res.status).to.equal(200);
+ assert.equal(res.status, 200);
const html = await res.text();
const { document } = parseHTML(html);
const imgs = document.getElementsByTagName('img');
- expect(imgs.length).to.equal(2);
+ assert.equal(imgs.length, 2);
const assetsImg = imgs.item(0);
- expect(assetsImg.src.startsWith('/_image')).to.be.true;
- expect(assetsImg.hasAttribute('data-my-image')).to.be.true;
+ assert.equal(assetsImg.src.startsWith('/_image'), true);
+ assert.equal(assetsImg.hasAttribute('data-my-image'), true);
const publicImg = imgs.item(1);
- expect(publicImg.src).to.equal('/favicon.svg');
- expect(publicImg.hasAttribute('data-my-image')).to.be.true;
+ assert.equal(publicImg.src, '/favicon.svg');
+ assert.equal(publicImg.hasAttribute('data-my-image'), true);
});
}
});