remove hard coded routes

This commit is contained in:
Devin Zuczek
2026-06-29 22:41:17 -04:00
parent 69b89e2dc4
commit 81815ef06c
29 changed files with 122 additions and 256 deletions
+5 -2
View File
@@ -2,16 +2,19 @@ import { exports } from 'cloudflare:workers'
import { describe, expect, test } from 'vitest'
import '../../ns.app'
import endpoints from '../../../static/endpoints.json'
import { buildEndpoints } from '../../endpoints'
const ORIGIN = 'https://example.com'
// Must match the DOMAIN var default in apps/ns/wrangler.jsonc.
const TEST_DOMAIN = 'rec.example.com'
describe('ns endpoints', () => {
test('GET / returns the endpoints document', async () => {
const res = await exports.default.fetch(`${ORIGIN}/`)
expect(res.status).toBe(200)
const body = await res.json()
expect(body).toEqual(endpoints)
expect(body).toEqual(buildEndpoints(TEST_DOMAIN))
})
test('unknown path returns 404', async () => {