From 46ed4af90a1b504e1b160fc248bcf74a6059ddc7 Mon Sep 17 00:00:00 2001 From: Graham Langford Date: Thu, 25 Apr 2024 12:12:32 -0500 Subject: [PATCH] test bad values --- src/types/helpers.test.ts | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/types/helpers.test.ts b/src/types/helpers.test.ts index 2750448fe2..a52101d95b 100644 --- a/src/types/helpers.test.ts +++ b/src/types/helpers.test.ts @@ -53,6 +53,42 @@ describe("types/helpers.ts", () => { coerce: true, expected: true, }, + { + value: "lorem ipsum", + allowLeadingV: false, + coerce: false, + expected: false, + }, + { + value: "lorem ipsum", + allowLeadingV: false, + coerce: true, + expected: false, + }, + { + value: "", + allowLeadingV: false, + coerce: false, + expected: false, + }, + { + value: "", + allowLeadingV: false, + coerce: true, + expected: false, + }, + { + value: "vacant", + allowLeadingV: true, + coerce: false, + expected: false, + }, + { + value: "vacant", + allowLeadingV: true, + coerce: true, + expected: false, + }, ])( "$value with allowLeadingV: $allowLeadingV and coerce: $coerce returns $expected", ({ value, allowLeadingV, coerce, expected }) => { @@ -119,6 +155,36 @@ describe("types/helpers.ts", () => { allowLeadingV: true, coerce: false, }, + { + value: "lorem ipsum", + allowLeadingV: false, + coerce: false, + }, + { + value: "lorem ipsum", + allowLeadingV: false, + coerce: true, + }, + { + value: "", + allowLeadingV: false, + coerce: false, + }, + { + value: "", + allowLeadingV: false, + coerce: true, + }, + { + value: "vacant", + allowLeadingV: true, + coerce: false, + }, + { + value: "vacant", + allowLeadingV: true, + coerce: true, + }, ])( "$value with allowLeadingV: $allowLeadingV and coerce: $coerce throws an error", ({ value, allowLeadingV, coerce }) => {