All files / src/features/profile/api profile.schemas.ts

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

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 17 18 19 20 21 22 23 24 25    6x           6x           7x           6x        
import { z } from 'zod'
 
export const profileFormSchema = z.object({
  name: z.string().trim().min(1),
  avatarUrl: z.string().max(524288).optional(),
})
export type ProfileFormInput = z.infer<typeof profileFormSchema>
 
export const changePasswordFormSchema = z
  .object({
    currentPassword: z.string().min(1),
    newPassword: z.string().min(8),
    confirmNewPassword: z.string().min(8),
  })
  .refine((values) => values.newPassword === values.confirmNewPassword, {
    message: 'profile.password.mismatch',
    path: ['confirmNewPassword'],
  })
export type ChangePasswordFormInput = z.infer<typeof changePasswordFormSchema>
 
export const deleteAccountFormSchema = z.object({
  currentPassword: z.string().min(1),
})
export type DeleteAccountFormInput = z.infer<typeof deleteAccountFormSchema>