Skip to content

Commit 3f2e5e3

Browse files
committed
test: add a test to ensure the correctness of timezone upgrades
Currently, there's no way to know if a timezone upgrade PR is correct without building and testing the change locally. This change provides a solution for that. Tested in #4. Signed-off-by: Darshan Sen <[email protected]>
1 parent e43ecd5 commit 3f2e5e3

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

.github/workflows/timezone-update.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636

3737
- run: ./tools/update-timezone.mjs
3838

39+
- name: Update the expected timezone version in test
40+
run: echo "${{ env.new_version }}" > test/fixtures/tz-version.txt
41+
3942
- name: Open Pull Request
4043
uses: gr2m/create-or-update-pull-request-action@dc1726cbf4dd3ce766af4ec29cfb660e0125e8ee # Create a PR or update the Action's existing PR
4144
env:

test/fixtures/tz-version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022e

test/parallel/test-tz-version.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
require('../common');
4+
const { path } = require('../common/fixtures');
5+
6+
// This test ensures the correctness of the automated timezone upgrade PRs.
7+
8+
const { strictEqual } = require('assert');
9+
const { readFileSync } = require('fs');
10+
11+
const expectedVersion = readFileSync(path('tz-version.txt'), 'utf8').trim();
12+
strictEqual(process.versions.tz, expectedVersion);

0 commit comments

Comments
 (0)