Phase0
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 22s
CI / Go — edge-gateway build (push) Successful in 13s

This commit is contained in:
smueller
2026-06-26 11:12:51 +02:00
parent e25e871067
commit 4fe25e6ec3
106 changed files with 1002 additions and 160 deletions

View File

@@ -6,13 +6,15 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"test": "vitest run"
},
"dependencies": {
"zod": "^3.24.1"
},
"devDependencies": {
"@hexahost/typescript-config": "workspace:*",
"typescript": "^5.7.3"
"typescript": "^5.7.3",
"vitest": "^3.0.8"
}
}

View File

@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";
import { problemDetailsSchema } from "./error";
describe("problemDetailsSchema", () => {
it("accepts RFC 7807 problem details", () => {
const result = problemDetailsSchema.safeParse({
type: "https://example.com/errors/validation",
title: "Validation failed",
status: 400,
detail: "Invalid input",
instance: "/api/v1/servers",
});
expect(result.success).toBe(true);
});
});

View File

@@ -0,0 +1,23 @@
import { describe, expect, it } from "vitest";
import { healthResponseSchema } from "./health";
describe("healthResponseSchema", () => {
it("accepts a valid liveness response", () => {
const result = healthResponseSchema.safeParse({
status: "ok",
service: "api",
timestamp: new Date().toISOString(),
});
expect(result.success).toBe(true);
});
it("rejects invalid status values", () => {
const result = healthResponseSchema.safeParse({
status: "unknown",
service: "api",
timestamp: new Date().toISOString(),
});
expect(result.success).toBe(false);
});
});

View File

@@ -5,5 +5,5 @@
"rootDir": "./src"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
"exclude": ["node_modules", "dist", "src/**/*.test.ts"]
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
const dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
test: {
environment: "node",
include: ["src/**/*.test.ts"],
},
resolve: {
alias: {
"@": path.resolve(dirname, "./src"),
},
},
});