Initial commit

This commit is contained in:
2026-04-17 23:26:01 +00:00
commit 2ea4ca5d52
409 changed files with 63459 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { describe, it, expect } from 'vitest'
import * as z from 'zod'
// Mirrors the schema defined in app/pages/login.vue
const schema = z.object({
email: z.email(),
otp: z.array(z.string()).optional().transform(val => val?.join(''))
})
describe('login schema', () => {
it('accepts a valid email', () => {
const result = schema.safeParse({ email: 'user@example.com' })
expect(result.success).toBe(true)
})
it('rejects an invalid email', () => {
const result = schema.safeParse({ email: 'not-an-email' })
expect(result.success).toBe(false)
})
it('joins otp array into a single string', () => {
const result = schema.safeParse({ email: 'user@example.com', otp: ['1', '2', '3', '4', '5', '6'] })
expect(result.success).toBe(true)
if (result.success) expect(result.data.otp).toBe('123456')
})
})