Skip to content

Commit

Permalink
test: add validation for empty schema in environment variable checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tuki0918 committed Dec 20, 2024
1 parent 9cebf5f commit adca05b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ describe("zenv.validate", () => {
});
});

it("should not access environment variables if schema is not defined", () => {
const schema = zenv.object({});
const env = {
PORT: "3000",
DEBUG_MODE: "true",
APP_ENV: "development",
};

const result = zenv.validate(schema, env);

expect(result).toEqual({});
});

it("should throw an error for invalid environment variables", () => {
const schema = zenv.object({
PORT: zenv.number(),
Expand Down

0 comments on commit adca05b

Please sign in to comment.