From 8555c2e3c7d112724d5cd9971a7ec6ffcc2ad543 Mon Sep 17 00:00:00 2001 From: "voxel!()" Date: Thu, 8 Feb 2024 02:23:56 -0800 Subject: [PATCH] chore: Migrate `markdown.test.js` to `node:test` (#10032) --- ...{markdown.test.js => markdown.nodetest.js} | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) rename packages/astro/test/{markdown.test.js => markdown.nodetest.js} (61%) diff --git a/packages/astro/test/markdown.test.js b/packages/astro/test/markdown.nodetest.js similarity index 61% rename from packages/astro/test/markdown.test.js rename to packages/astro/test/markdown.nodetest.js index 1df89715b0..ad8d2de0a6 100644 --- a/packages/astro/test/markdown.test.js +++ b/packages/astro/test/markdown.nodetest.js @@ -1,4 +1,5 @@ -import { expect } from 'chai'; +import assert from 'node:assert/strict'; +import { describe, before, it } from 'node:test'; import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; @@ -20,57 +21,57 @@ describe('Markdown tests', () => { it('Can load a markdown page with the `.markdown` extension', async () => { const html = await fixture.readFile('/dot-markdown-page/index.html'); const $ = cheerio.load(html); - expect($('h1').html()).to.equal('Page with alternative .markdown extension'); - expect($('p').html()).to.equal('Hope this loads fine 🤞'); + assert.strictEqual($('h1').html(), 'Page with alternative .markdown extension'); + assert.strictEqual($('p').html(), 'Hope this loads fine 🤞'); }); it('Can load a markdown page with the `.mdwn` extension', async () => { const html = await fixture.readFile('/dot-mdwn-page/index.html'); const $ = cheerio.load(html); - expect($('h1').html()).to.equal('Page with alternative .mdwn extension'); - expect($('p').html()).to.equal('Hope this loads fine 🤞'); + assert.strictEqual($('h1').html(), 'Page with alternative .mdwn extension'); + assert.strictEqual($('p').html(), 'Hope this loads fine 🤞'); }); it('Can load a markdown page with the `.mkdn` extension', async () => { const html = await fixture.readFile('/dot-mkdn-page/index.html'); const $ = cheerio.load(html); - expect($('h1').html()).to.equal('Page with alternative .mkdn extension'); - expect($('p').html()).to.equal('Hope this loads fine 🤞'); + assert.strictEqual($('h1').html(), 'Page with alternative .mkdn extension'); + assert.strictEqual($('p').html(), 'Hope this loads fine 🤞'); }); it('Can load a markdown page with the `.mdown` extension', async () => { const html = await fixture.readFile('/dot-mdown-page/index.html'); const $ = cheerio.load(html); - expect($('h1').html()).to.equal('Page with alternative .mdown extension'); - expect($('p').html()).to.equal('Hope this loads fine 🤞'); + assert.strictEqual($('h1').html(), 'Page with alternative .mdown extension'); + assert.strictEqual($('p').html(), 'Hope this loads fine 🤞'); }); it('Can load a markdown page with the `.mkd` extension', async () => { const html = await fixture.readFile('/dot-mkd-page/index.html'); const $ = cheerio.load(html); - expect($('h1').html()).to.equal('Page with alternative .mkd extension'); - expect($('p').html()).to.equal('Hope this loads fine 🤞'); + assert.strictEqual($('h1').html(), 'Page with alternative .mkd extension'); + assert.strictEqual($('p').html(), 'Hope this loads fine 🤞'); }); it('Can load a simple markdown page with Astro', async () => { const html = await fixture.readFile('/post/index.html'); const $ = cheerio.load(html); - expect($('p').first().text()).to.equal('Hello world!'); - expect($('#first').text()).to.equal('Some content'); - expect($('#interesting-topic').text()).to.equal('Interesting Topic'); + assert.strictEqual($('p').first().text(), 'Hello world!'); + assert.strictEqual($('#first').text(), 'Some content'); + assert.strictEqual($('#interesting-topic').text(), 'Interesting Topic'); }); it('Can load a realworld markdown page with Astro', async () => { const html = await fixture.readFile('/realworld/index.html'); const $ = cheerio.load(html); - expect($('pre')).to.have.lengthOf(7); + assert.strictEqual($('pre').length, 7); }); it('Does not unescape entities', async () => { const html = await fixture.readFile('/entities/index.html'); - expect(html).to.match(/<i>This should NOT be italic<\/i>/); + assert.match(html, /<i>This should NOT be italic<\/i>/); }); }); });