43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { expect, test } from "vitest";
|
|
import { agencyCloseSchema, agencyJoinEnabledSchema, coinSellerStatusSchema } from "./schema";
|
|
|
|
test("coin seller contact accepts plus sign with large internal user id", () => {
|
|
const result = coinSellerStatusSchema.safeParse({
|
|
commandId: "coin-seller-edit-test",
|
|
contact: "+63",
|
|
reason: "update contact",
|
|
status: "active",
|
|
targetUserId: "320756743338463232",
|
|
});
|
|
|
|
expect(result.success).toBe(true);
|
|
if (result.success) {
|
|
expect(result.data.contact).toBe("+63");
|
|
expect(result.data.targetUserId).toBe("320756743338463232");
|
|
}
|
|
});
|
|
|
|
test("agency action schemas preserve large agency ids as strings", () => {
|
|
const agencyId = "321170072154411009";
|
|
const closeResult = agencyCloseSchema.safeParse({
|
|
agencyId,
|
|
commandId: "agency-close-test",
|
|
reason: "close agency",
|
|
});
|
|
const joinResult = agencyJoinEnabledSchema.safeParse({
|
|
agencyId,
|
|
commandId: "agency-join-test",
|
|
joinEnabled: false,
|
|
reason: "disable join",
|
|
});
|
|
|
|
expect(closeResult.success).toBe(true);
|
|
expect(joinResult.success).toBe(true);
|
|
if (closeResult.success) {
|
|
expect(closeResult.data.agencyId).toBe(agencyId);
|
|
}
|
|
if (joinResult.success) {
|
|
expect(joinResult.data.agencyId).toBe(agencyId);
|
|
}
|
|
});
|