Add extra tests

This commit is contained in:
Adria Navarro 2024-05-23 14:53:17 +02:00
parent d1ef9067dc
commit b8400294d5
1 changed files with 13 additions and 1 deletions

View File

@ -194,7 +194,7 @@ describe("validate", () => {
}, },
} }
it.each(["10:00", "15:00", `9:${minute()}`, "16:34"])( it.each(["10:00", "15:00", `9:${minute()}`, "16:34", "00:00"])(
"should accept values in range (%s)", "should accept values in range (%s)",
async time => { async time => {
const row = { time } const row = { time }
@ -202,6 +202,18 @@ describe("validate", () => {
expect(output.valid).toBe(true) expect(output.valid).toBe(true)
} }
) )
it.each(["10:01", "14:59:59", `12:${minute()}`])(
"should reject values out range (%s)",
async time => {
const row = { time }
const output = await validate({ table, tableId: table._id!, row })
expect(output.valid).toBe(false)
expect(output.errors).toEqual({
time: ["must be no later than 10:00"],
})
}
)
}) })
}) })
}) })