diff options
Diffstat (limited to 'packages/integrations/markdoc/test/image-assets.test.js')
-rw-r--r-- | packages/integrations/markdoc/test/image-assets.test.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/packages/integrations/markdoc/test/image-assets.test.js b/packages/integrations/markdoc/test/image-assets.test.js index 7339960dd..ae576b5cf 100644 --- a/packages/integrations/markdoc/test/image-assets.test.js +++ b/packages/integrations/markdoc/test/image-assets.test.js @@ -1,6 +1,7 @@ import { parseHTML } from 'linkedom'; -import { expect } from 'chai'; import { loadFixture } from '../../../astro/test/test-utils.js'; +import assert from 'node:assert/strict'; +import { after, before, describe, it } from 'node:test'; const root = new URL('./fixtures/image-assets/', import.meta.url); @@ -28,14 +29,15 @@ describe('Markdoc - Image assets', () => { const res = await baseFixture.fetch('/'); const html = await res.text(); const { document } = parseHTML(html); - expect(document.querySelector('#public > img')?.src).to.equal('/favicon.svg'); + assert.equal(document.querySelector('#public > img')?.src, '/favicon.svg'); }); it('transforms relative image paths to optimized path', async () => { const res = await baseFixture.fetch('/'); const html = await res.text(); const { document } = parseHTML(html); - expect(document.querySelector('#relative > img')?.src).to.match( + assert.match( + document.querySelector('#relative > img')?.src, /\/_image\?href=.*%2Fsrc%2Fassets%2Frelative%2Foar.jpg%3ForigWidth%3D420%26origHeight%3D630%26origFormat%3Djpg&f=webp/ ); }); @@ -44,7 +46,8 @@ describe('Markdoc - Image assets', () => { const res = await baseFixture.fetch('/'); const html = await res.text(); const { document } = parseHTML(html); - expect(document.querySelector('#alias > img')?.src).to.match( + assert.match( + document.querySelector('#alias > img')?.src, /\/_image\?href=.*%2Fsrc%2Fassets%2Falias%2Fcityscape.jpg%3ForigWidth%3D420%26origHeight%3D280%26origFormat%3Djpg&f=webp/ ); }); @@ -58,19 +61,19 @@ describe('Markdoc - Image assets', () => { it('uses public/ image paths unchanged', async () => { const html = await baseFixture.readFile('/index.html'); const { document } = parseHTML(html); - expect(document.querySelector('#public > img')?.src).to.equal('/favicon.svg'); + assert.equal(document.querySelector('#public > img')?.src, '/favicon.svg'); }); it('transforms relative image paths to optimized path', async () => { const html = await baseFixture.readFile('/index.html'); const { document } = parseHTML(html); - expect(document.querySelector('#relative > img')?.src).to.match(/^\/_astro\/oar.*\.webp$/); + assert.match(document.querySelector('#relative > img')?.src, /^\/_astro\/oar.*\.webp$/); }); it('transforms aliased image paths to optimized path', async () => { const html = await baseFixture.readFile('/index.html'); const { document } = parseHTML(html); - expect(document.querySelector('#alias > img')?.src).to.match(/^\/_astro\/cityscape.*\.webp$/); + assert.match(document.querySelector('#alias > img')?.src, /^\/_astro\/cityscape.*\.webp$/); }); }); }); |