0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

chore: Migrate html-escape.test.js to node:test (#10042)

This commit is contained in:
Mohamed 2024-02-08 12:21:03 +02:00 committed by GitHub
parent aa7680e75e
commit 3c0e2c728e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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"}!`)')
});
});
});