summaryrefslogtreecommitdiff
path: root/packages/astro/test/html-page.test.js
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2022-07-22 10:32:36 -0500
committerGravatar GitHub <noreply@github.com> 2022-07-22 10:32:36 -0500
commit7250e4e86da41e7c662afa4b67f7cefc7da15e69 (patch)
tree601206ba1e6604a2a3cf0cb7111738c85fbcc356 /packages/astro/test/html-page.test.js
parent8b468ccccc0e47c3153175a3a9f3eadb191a8f0c (diff)
downloadastro-7250e4e86da41e7c662afa4b67f7cefc7da15e69.tar.gz
astro-7250e4e86da41e7c662afa4b67f7cefc7da15e69.tar.zst
astro-7250e4e86da41e7c662afa4b67f7cefc7da15e69.zip
Add `.html` support (#3867)
* feat: add html package * feat: support assets in HTML * feat(html): upgrade html integration * feat(html): add `@astrojs/html` integration * feat(html): add html support to astro core * test(html): update html tests with package.json files * chore: add changeset * fix: remove import cycle * chore: fix types * refactor: remove @astrojs/html, add to core * chore: update types for `*.html` * fix: move *.html to astro/env Co-authored-by: Nate Moore <nate@astro.build>
Diffstat (limited to '')
-rw-r--r--packages/astro/test/html-page.test.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/astro/test/html-page.test.js b/packages/astro/test/html-page.test.js
new file mode 100644
index 000000000..fe4c01f68
--- /dev/null
+++ b/packages/astro/test/html-page.test.js
@@ -0,0 +1,53 @@
+import { expect } from 'chai';
+import * as cheerio from 'cheerio';
+import { loadFixture } from './test-utils.js';
+
+describe('HTML Page', () => {
+ let fixture;
+
+ before(async () => {
+ fixture = await loadFixture({
+ root: './fixtures/html-page/',
+ });
+ });
+
+ describe('build', () => {
+ before(async () => {
+ await fixture.build();
+ });
+
+ it('works', async () => {
+ const html = await fixture.readFile('/index.html');
+ const $ = cheerio.load(html)
+
+ const h1 = $('h1');
+
+ expect(h1.text()).to.equal('Hello page!');
+ });
+ });
+
+ describe('dev', () => {
+ let devServer;
+
+ before(async () => {
+ devServer = await fixture.startDevServer();
+ });
+
+ after(async () => {
+ await devServer.stop();
+ });
+
+ it('works', async () => {
+ const res = await fixture.fetch('/');
+
+ expect(res.status).to.equal(200);
+
+ const html = await res.text();
+ const $ = cheerio.load(html)
+
+ const h1 = $('h1');
+
+ expect(h1.text()).to.equal('Hello page!');
+ });
+ });
+});