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:
parent
aa7680e75e
commit
3c0e2c728e
1 changed files with 11 additions and 10 deletions
|
@ -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"}!`)')
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue