Files
OmniRoute/tests/unit/modular-schemas.test.ts
Paijo 05213ac6a2 refactor: modularize schemas (non-stacked) (#3988)
Modularize validation schemas (#3594). Integrated into release/v3.8.27 after rebase (reconciled the merged hiddenSidebarGroupLabels #3971 + intelligenceSyncRequestSchema into the new modules) + behavior verification (typecheck, 195 schema/settings/validation tests, build 556/556).

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
2026-06-16 11:18:40 -03:00

36 lines
900 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import {
createProviderSchema,
createKeySchema,
loginSchema,
} from "../../src/shared/validation/schemas.ts";
test("modular schemas: createProviderSchema validates correctly", () => {
const valid = createProviderSchema.safeParse({
name: "openai",
provider: "openai",
apiKey: "sk-1234",
});
assert.equal(valid.success, true);
});
test("modular schemas: createKeySchema validates correctly", () => {
const valid = createKeySchema.safeParse({
name: "test-key",
});
assert.equal(valid.success, true);
});
test("modular schemas: loginSchema validates correctly", () => {
const valid = loginSchema.safeParse({
password: "securepassword",
});
assert.equal(valid.success, true);
const invalid = loginSchema.safeParse({
password: "",
});
assert.equal(invalid.success, false);
});