Skip to content

Commit

Permalink
test: ✅ Add "No value" tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pklaschka committed Oct 29, 2024
1 parent 6af115d commit 492bcd7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mod_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,22 @@ Deno.test("initVariable", async (t) => {
"Expected the default value to be used in process.env",
);
});

await t.step("No Value", async (t) => {
prepare();
await assertRejects(
() => initVariable(ENV_VAR, REQUIRED_PASSING),
ConfigParseError,
undefined,
"Expected a ConfigParseError when no value is set",
);

prepare();
await initVariable(ENV_VAR, OPTIONAL_PASSING);
await assertEquals(
Deno.env.get(ENV_VAR),
undefined,
"Expected the value to be undefined",
);
});
});

0 comments on commit 492bcd7

Please sign in to comment.