refactor(errors): migrate decisions to {code,msg}
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Actor } from "@/lib/actor"
|
||||
import { evaluateOrderTransition } from "@/lib/domain/order-machine"
|
||||
import type { Actor } from "@/lib/policy/actor"
|
||||
import type { UserRole } from "@/lib/types"
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
@@ -32,7 +32,7 @@ describe("evaluateOrderTransition", () => {
|
||||
|
||||
expect(result.decision).toMatchObject({
|
||||
ok: false,
|
||||
reasonCode: "INVALID_STATUS",
|
||||
error: { code: 400 },
|
||||
})
|
||||
expect(result.nextStatus).toBeUndefined()
|
||||
})
|
||||
@@ -46,7 +46,7 @@ describe("evaluateOrderTransition", () => {
|
||||
|
||||
expect(result.decision).toMatchObject({
|
||||
ok: false,
|
||||
reasonCode: "ROLE_FORBIDDEN",
|
||||
error: { code: 403 },
|
||||
})
|
||||
})
|
||||
|
||||
@@ -117,7 +117,7 @@ describe("evaluateOrderTransition", () => {
|
||||
|
||||
expect(result.decision).toMatchObject({
|
||||
ok: false,
|
||||
reasonCode: "ROLE_FORBIDDEN",
|
||||
error: { code: 403 },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user