diff --git a/mod_test.ts b/mod_test.ts index 15a8c88..477beb3 100644 --- a/mod_test.ts +++ b/mod_test.ts @@ -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", + ); + }); });