Skip to content

Commit

Permalink
test bad values
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamlangford committed Apr 25, 2024
1 parent 75415e6 commit 46ed4af
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/types/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down Expand Up @@ -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 }) => {
Expand Down

0 comments on commit 46ed4af

Please sign in to comment.