Files
juwan-frontend/tests/orders-api.test.ts
T
2026-02-28 07:26:34 +08:00

23 lines
553 B
TypeScript

import { createPaidOrder } from "@/lib/api/orders"
import { useAuthStore } from "@/store/auth"
import { describe, expect, it } from "vitest"
describe("lib/api/orders", () => {
it("returns { decision: { ok:false, error:{code,msg} } } when unauthenticated", () => {
useAuthStore.getState().logout()
const res = createPaidOrder({
playerId: "1005",
serviceId: "5001",
quantity: 1,
})
expect(res).toEqual({
decision: {
ok: false,
error: { code: 401, msg: "请先登录" },
},
})
})
})