From 3c0e2c728e18fa871921941d28d258bf93808682 Mon Sep 17 00:00:00 2001 From: Mohamed <10786768+xMohamd@users.noreply.github.com> Date: Thu, 8 Feb 2024 12:21:03 +0200 Subject: [PATCH] chore: Migrate `html-escape.test.js` to `node:test` (#10042) --- ...escape.test.js => html-escape.nodetest.js} | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) rename packages/astro/test/{html-escape.test.js => html-escape.nodetest.js} (65%) diff --git a/packages/astro/test/html-escape.test.js b/packages/astro/test/html-escape.nodetest.js similarity index 65% rename from packages/astro/test/html-escape.test.js rename to packages/astro/test/html-escape.nodetest.js index 047a566708..32f96a5126 100644 --- a/packages/astro/test/html-escape.test.js +++ b/packages/astro/test/html-escape.nodetest.js @@ -1,4 +1,5 @@ -import { expect } from 'chai'; +import assert from 'node:assert/strict'; +import { after, describe, before, it } from 'node:test'; import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; @@ -21,16 +22,16 @@ describe('HTML Escape', () => { const $ = cheerio.load(html); const div = $('div'); - expect(div.text()).to.equal('${foo}'); + assert.equal(div.text(), '${foo}'); const span = $('span'); - expect(span.attr('${attr}')).to.equal(''); + assert.equal(span.attr('${attr}'), ''); const ce = $('custom-element'); - expect(ce.attr('x-data')).to.equal('`${test}`'); + assert.equal(ce.attr('x-data'), '`${test}`'); const script = $('script'); - expect(script.text()).to.equal('console.log(`hello ${"world"}!`)'); + assert.equal(script.text(), 'console.log(`hello ${"world"}!`)'); }); }); @@ -48,22 +49,22 @@ describe('HTML Escape', () => { 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 $ = cheerio.load(html); const div = $('div'); - expect(div.text()).to.equal('${foo}'); + assert.equal(div.text(), '${foo}'); const span = $('span'); - expect(span.attr('${attr}')).to.equal(''); + assert.equal(span.attr('${attr}'), ''); const ce = $('custom-element'); - expect(ce.attr('x-data')).to.equal('`${test}`'); + assert.equal(ce.attr('x-data'), '`${test}`') const script = $('script'); - expect(script.text()).to.equal('console.log(`hello ${"world"}!`)'); + assert.equal(script.text(), 'console.log(`hello ${"world"}!`)') }); }); });