Skip to content

Commit

Permalink
deno.env test
Browse files Browse the repository at this point in the history
  • Loading branch information
littledivy committed Jan 28, 2025
1 parent 8a8269d commit bb96c03
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/specs/run/tz_env/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"steps": [
{
"if": "unix",
"args": "run -A main.ts",
"output": "ok\n"
}
]
}
13 changes: 13 additions & 0 deletions tests/specs/run/tz_env/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const date = new Date("2018-04-14T12:34:56.789Z");

Deno.env.set("TZ", "Europe/Amsterdam");
if (!date.toString().match(/^Sat Apr 14 2018 14:34:56 GMT\+0200 \(.+\)$/)) {
throw new Error(`date.toString() did not match the expected pattern`);
}

Deno.env.set("TZ", "Europe/London");
if (!date.toString().match(/^Sat Apr 14 2018 13:34:56 GMT\+0100 \(.+\)$/)) {
throw new Error(`date.toString() did not match the expected pattern`);
}

console.log("ok");

0 comments on commit bb96c03

Please sign in to comment.