39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
import { createConsumerSchema } from "../src/shared/validation/consumer.schemas.js";
|
|
|
|
describe("consumer schema fixed option lists", () => {
|
|
it("accepts valid predefined domain values", () => {
|
|
const parsed = createConsumerSchema.safeParse({
|
|
projectId: "p1",
|
|
name: "Test",
|
|
quantity: 1,
|
|
installedPowerPerUnitKw: 1,
|
|
demandFactor: 1,
|
|
deviceType: "Beleuchtung",
|
|
phaseType: "3-phasig",
|
|
tradeOrCostGroup: "KG 440 Starkstromanlagen",
|
|
group: "Technik",
|
|
protectionType: "LS",
|
|
protectionCharacteristic: "C",
|
|
cableType: "NYM-J",
|
|
cableCrossSection: "2,5 mm²",
|
|
});
|
|
|
|
assert.equal(parsed.success, true);
|
|
});
|
|
|
|
it("rejects unknown domain values", () => {
|
|
const parsed = createConsumerSchema.safeParse({
|
|
projectId: "p1",
|
|
name: "Test",
|
|
quantity: 1,
|
|
installedPowerPerUnitKw: 1,
|
|
demandFactor: 1,
|
|
deviceType: "Irgendwas",
|
|
});
|
|
|
|
assert.equal(parsed.success, false);
|
|
});
|
|
});
|