- Bootstraps `src/core/` foundation (`db.ts`, `valkey.ts`, `spire_ffi.ts`, `main.ts`). - Adds `auth_guards.ts` for payload capping, CSRF check, and rate limiting. - Adds `content_negotiation.ts` and `sse_adapter.ts` for Datastar transport helpers. - Adds `error_fragments.tsx` for standardized Datastar error morphs. - Introduces `scripts/lint_arch.ts` to block imperative DOM usage. - Updates `deno.json` with src workspace configs and lint commands. Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
17 lines
524 B
TypeScript
17 lines
524 B
TypeScript
import { assertEquals } from "jsr:@std/assert";
|
|
import { determineClientType } from "./content_negotiation.ts";
|
|
import { Context } from "jsr:@hono/hono@4";
|
|
|
|
Deno.test("determineClientType - correctly identifies datastar", () => {
|
|
const mockContext = {
|
|
req: {
|
|
header: (name: string) => {
|
|
if (name === "datastar-request") return "true";
|
|
return "";
|
|
}
|
|
}
|
|
} as unknown as Context;
|
|
|
|
assertEquals(determineClientType(mockContext), "datastar");
|
|
});
|