feat(orchestration): add v4 additive backend core and policy tests
This commit is contained in:
1 parent
eb17c8e284
commit
e5c83e87fe
18 files changed
+586
-14
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { BadRequestException, ConflictException, ForbiddenException } from "@nestjs/common";
|
||||
import { assertTransition, nextStateForGateDecision, OperationMode, WorkflowState } from "./orchestration.domain";
|
||||
|
||||
describe("orchestration domain", () => {
|
||||
it("allows only declared workflow transitions", () => {
|
||||
expect(() => assertTransition(WorkflowState.DRAFT, WorkflowState.GATE1_PENDING)).not.toThrow();
|
||||
expect(() => assertTransition(WorkflowState.DRAFT, WorkflowState.RUNNING)).toThrow(BadRequestException);
|
||||
});
|
||||
|
||||
it("keeps gate 1 as execution authorization rather than release authorization", () => {
|
||||
expect(nextStateForGateDecision(1, "APPROVED")).toBe(WorkflowState.GATE1_APPROVED);
|
||||
expect(nextStateForGateDecision(2, "APPROVED")).toBe(WorkflowState.GATE2_APPROVED);
|
||||
});
|
||||
|
||||
it("rejects an unsupported gate decision", () => {
|
||||
expect(() => nextStateForGateDecision(1, "PENDING" as never)).toThrow(BadRequestException);
|
||||
});
|
||||
|
||||
it("classifies production mutation separately from observe and prepare", () => {
|
||||
expect(OperationMode.OBSERVE).toBe("OBSERVE");
|
||||
expect(OperationMode.PREPARE).toBe("PREPARE");
|
||||
expect(OperationMode.MUTATE_PRODUCTION).toBe("MUTATE_PRODUCTION");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user