All files / react-app/src/formSchemas capitated-initial.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16        72x           54x          
import { events } from "shared-types/events";
import { isAuthorizedState } from "@/utils";
import { itemExists } from "@/api";
 
export const formSchema = events["capitated-initial"].baseSchema.extend({
  id: events["capitated-initial"].baseSchema.shape.id
    .refine(isAuthorizedState, {
      message:
        "You can only submit for a state you have access to. If you need to add another state, visit your IDM user profile to request access.",
    })
    .refine(async (value) => !(await itemExists(value)), {
      message:
        "According to our records, this 1915(b) Waiver Number already exists. Please check the 1915(b) Waiver Number and try entering it again.",
    }),
});