diff --git a/routes/admin/index.ts b/routes/admin/index.ts
index a1ec637..bd33614 100644
--- a/routes/admin/index.ts
+++ b/routes/admin/index.ts
@@ -17,10 +17,10 @@ export default withRouteSpec({
diff --git a/tests/fixtures/get-test-server.ts b/tests/fixtures/get-test-server.ts
index 7063c41..e58f9ed 100644
--- a/tests/fixtures/get-test-server.ts
+++ b/tests/fixtures/get-test-server.ts
@@ -1,5 +1,4 @@
import { afterEach } from "bun:test"
-import { tmpdir } from "node:os"
import defaultAxios from "redaxios"
import { startServer } from "./start-server"
@@ -10,16 +9,15 @@ interface TestFixture {
}
export const getTestServer = async (): Promise => {
- const port = 3001 + Math.floor(Math.random() * 999)
const testInstanceId = Math.random().toString(36).substring(2, 15)
const testDbName = `testdb${testInstanceId}`
const server = await startServer({
- port,
+ port: 0,
testDbName,
})
- const url = `http://127.0.0.1:${port}`
+ const url = `http://127.0.0.1:${server.port}`
const axios = defaultAxios.create({
baseURL: url,
})
diff --git a/tests/routes/admin-index.test.ts b/tests/routes/admin-index.test.ts
new file mode 100644
index 0000000..83486b1
--- /dev/null
+++ b/tests/routes/admin-index.test.ts
@@ -0,0 +1,20 @@
+import { test, expect } from "bun:test"
+import { getTestServer } from "tests/fixtures/get-test-server"
+
+test("admin dashboard links resolve to existing admin routes", async () => {
+ const { axios } = await getTestServer()
+
+ const res = await axios.get("/admin")
+ const html = res.data as string
+
+ expect(html).toContain('href="./files/list"')
+ expect(html).toContain('href="./events/list"')
+ expect(html).not.toContain('href="./admin/files/list"')
+ expect(html).not.toContain('href="./admin/events/list"')
+
+ const filesRes = await axios.get("/admin/files/list")
+ expect(filesRes.status).toBe(200)
+
+ const eventsRes = await axios.get("/admin/events/list")
+ expect(eventsRes.status).toBe(200)
+})