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

chore: Migrate html-slots.test.js to node:test (#10044)

This commit is contained in:
Mohamed 2024-02-08 12:19:16 +02:00 committed by GitHub
parent c9cf8a93fb
commit 648e714e3e
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,19 +22,19 @@ describe('HTML Slots', () => {
const $ = cheerio.load(html);
const slotDefault = $('#default');
expect(slotDefault.text()).to.equal('Default');
assert.equal(slotDefault.text(), 'Default');
const a = $('#a');
expect(a.text().trim()).to.equal('A');
assert.equal(a.text().trim(), 'A');
const b = $('#b');
expect(b.text().trim()).to.equal('B');
assert.equal(b.text().trim(), 'B');
const c = $('#c');
expect(c.text().trim()).to.equal('C');
assert.equal(c.text().trim(), 'C');
const inline = $('#inline');
expect(inline.html()).to.equal('<slot is:inline=""></slot>');
assert.equal(inline.html(), '<slot is:inline=""></slot>');
});
});
@ -51,25 +52,25 @@ describe('HTML Slots', () => {
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 slotDefault = $('#default');
expect(slotDefault.text()).to.equal('Default');
assert.equal(slotDefault.text(), 'Default')
const a = $('#a');
expect(a.text().trim()).to.equal('A');
assert.equal(a.text().trim(), 'A');
const b = $('#b');
expect(b.text().trim()).to.equal('B');
assert.equal(b.text().trim(), 'B');
const c = $('#c');
expect(c.text().trim()).to.equal('C');
assert.equal(c.text().trim(), 'C');
const inline = $('#inline');
expect(inline.html()).to.equal('<slot is:inline=""></slot>');
assert.equal(inline.html(), '<slot is:inline=""></slot>')
});
});
});