test(chat): add test for defaulting nullable credit fields to zero
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { stringOrEmpty } from "../nullable-defaults";
|
||||
import { numberOrZero, stringOrEmpty } from "../nullable-defaults";
|
||||
import { ChatLockDetailSchema } from "./chat_payloads";
|
||||
|
||||
/**
|
||||
@@ -12,10 +12,10 @@ export const UnlockPrivateResponseSchema = z.object({
|
||||
unlocked: z.boolean(),
|
||||
content: stringOrEmpty,
|
||||
reason: UnlockPrivateReasonSchema,
|
||||
creditBalance: z.number().default(0),
|
||||
creditsCharged: z.number().default(0),
|
||||
requiredCredits: z.number().default(0),
|
||||
shortfallCredits: z.number().default(0),
|
||||
creditBalance: numberOrZero,
|
||||
creditsCharged: numberOrZero,
|
||||
requiredCredits: numberOrZero,
|
||||
shortfallCredits: numberOrZero,
|
||||
lockDetail: ChatLockDetailSchema,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user