mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
chore: Migrate custom-404-html.test.js
to node:test
(#10025)
This commit is contained in:
parent
15b9e5a8c5
commit
92b6eb0ac2
1 changed files with 6 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
import { expect } from 'chai';
|
|
||||||
import * as cheerio from 'cheerio';
|
import * as cheerio from 'cheerio';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { after, describe, before, it } from 'node:test';
|
||||||
|
|
||||||
describe('Custom 404.html', () => {
|
describe('Custom 404.html', () => {
|
||||||
let fixture;
|
let fixture;
|
||||||
|
@ -28,18 +29,18 @@ describe('Custom 404.html', () => {
|
||||||
const html = await fixture.fetch('/').then((res) => res.text());
|
const html = await fixture.fetch('/').then((res) => res.text());
|
||||||
$ = cheerio.load(html);
|
$ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('h1').text()).to.equal('Home');
|
assert.strictEqual($('h1').text(), 'Home');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders 404 for /a', async () => {
|
it('renders 404 for /a', async () => {
|
||||||
const res = await fixture.fetch('/a');
|
const res = await fixture.fetch('/a');
|
||||||
expect(res.status).to.equal(404);
|
assert.strictEqual(res.status, 404);
|
||||||
|
|
||||||
const html = await res.text();
|
const html = await res.text();
|
||||||
$ = cheerio.load(html);
|
$ = cheerio.load(html);
|
||||||
|
|
||||||
expect($('h1').text()).to.equal('Page not found');
|
assert.strictEqual($('h1').text(), 'Page not found');
|
||||||
expect($('p').text()).to.equal('This 404 is a static HTML file.');
|
assert.strictEqual($('p').text(), 'This 404 is a static HTML file.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in a new issue