23 lines
553 B
TypeScript
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: "请先登录" },
|
|
},
|
|
})
|
|
})
|
|
})
|