feature: sort imports to try to ensure parameter paths are less specific

This commit is contained in:
Andy Burke 2025-06-25 20:07:08 -07:00
parent c92ef0688b
commit 4f68a64a88
4 changed files with 72 additions and 10 deletions

View file

@ -0,0 +1,35 @@
import * as asserts from '@std/assert';
import { EPHEMERAL_SERVER, get_ephemeral_listen_server } from './helpers.ts';
Deno.test({
name: 'test that routes are sorted most to least specific',
permissions: {
env: true,
read: true,
write: true,
net: true
},
fn: async () => {
let test_server_info: EPHEMERAL_SERVER | null = null;
try {
Deno.env.set('SERVERUS_ROOT', './tests/www');
test_server_info = await get_ephemeral_listen_server();
const response = await fetch(`http://${test_server_info.hostname}:${test_server_info.port}/echo/hi`, {
method: 'GET'
});
const body = await response.text();
asserts.assert(response.ok);
asserts.assert(body);
asserts.assertEquals(body, 'hello');
} finally {
Deno.env.delete('SERVERUS_ROOT');
if (test_server_info) {
await test_server_info?.server?.stop();
}
}
}
});