summaryrefslogtreecommitdiff
path: root/test/astro-basic.test.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-04-05 14:18:09 -0400
committerGravatar GitHub <noreply@github.com> 2021-04-05 14:18:09 -0400
commitc9bc6ffef7be0e068acb1b36475c4ab3d12fd5d5 (patch)
treed444fa26d0ce47bb3cebb5e6264d67778a2e106d /test/astro-basic.test.js
parentd9733e8d42662d8708b5fc3bcb5c6c4db75df043 (diff)
downloadastro-c9bc6ffef7be0e068acb1b36475c4ab3d12fd5d5.tar.gz
astro-c9bc6ffef7be0e068acb1b36475c4ab3d12fd5d5.tar.zst
astro-c9bc6ffef7be0e068acb1b36475c4ab3d12fd5d5.zip
Improve searching for pages (#60)
This improves the algorithm for searching for pages. It now works like: 1. If pathname ends with / 1. Look for PATHNAME/index.astro 1. Look for PATHNAME/index.md 1. else 1. Look for PATHNAME.astro 1. Look for PATHNAME.md 1. Look for PATHNAME/index.astro 1. 301 1. Look for PATHNAME/index.md 1. 301 1. 404
Diffstat (limited to 'test/astro-basic.test.js')
-rw-r--r--test/astro-basic.test.js26
1 files changed, 5 insertions, 21 deletions
diff --git a/test/astro-basic.test.js b/test/astro-basic.test.js
index b06cdfcd0..053bf2fbb 100644
--- a/test/astro-basic.test.js
+++ b/test/astro-basic.test.js
@@ -1,29 +1,13 @@
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
-import { createRuntime } from '../lib/runtime.js';
-import { loadConfig } from '../lib/config.js';
import { doc } from './test-utils.js';
+import { setup } from './helpers.js';
-const Basics = suite('HMX Basics');
+const Basics = suite('Search paths');
-let runtime;
+setup(Basics, './fixtures/astro-basic');
-Basics.before(async () => {
- const astroConfig = await loadConfig(new URL('./fixtures/astro-basics', import.meta.url).pathname);
-
- const logging = {
- level: 'error',
- dest: process.stderr,
- };
-
- runtime = await createRuntime(astroConfig, { logging });
-});
-
-Basics.after(async () => {
- (await runtime) && runtime.shutdown();
-});
-
-Basics('Can load page', async () => {
+Basics('Can load page', async ({ runtime }) => {
const result = await runtime.load('/');
assert.equal(result.statusCode, 200);
@@ -32,4 +16,4 @@ Basics('Can load page', async () => {
assert.equal($('h1').text(), 'Hello world!');
});
-Basics.run();
+Basics.run(); \ No newline at end of file