From b732bbb6b18160dc5acbd1142ca0af6d42618e2c Mon Sep 17 00:00:00 2001 From: kang Date: Wed, 24 Apr 2024 16:52:50 +0900 Subject: [PATCH] fix: modify testing timezone to UTC --- package.json | 8 ++++---- .../nbCRDTWithNBDB/nbdb/evaluator/formula.test.ts | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 26a7bc8..1b2d6c6 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,10 @@ "build": "npm run build-iframe && tsc", "lint": "eslint .", "lint-fix": "eslint . --fix", - "test": "jest", - "test-cover": "jest --coverage", - "test-watch": "jest --watchAll=true", - "test-watch-cover": "jest --coverage --watchAll=true", + "test": "TZ=UTC jest", + "test-cover": "TZ=UTC jest --coverage", + "test-watch": "TZ=UTC jest --watchAll=true", + "test-watch-cover": "TZ=UTC jest --coverage --watchAll=true", "prepare": "npm run build", "pretest": "tsc", "posttest": "npm run lint", diff --git a/src/adapter/dataManipulator/nbCRDTWithNBDB/nbdb/evaluator/formula.test.ts b/src/adapter/dataManipulator/nbCRDTWithNBDB/nbdb/evaluator/formula.test.ts index a5d1e53..74c2879 100644 --- a/src/adapter/dataManipulator/nbCRDTWithNBDB/nbdb/evaluator/formula.test.ts +++ b/src/adapter/dataManipulator/nbCRDTWithNBDB/nbdb/evaluator/formula.test.ts @@ -8,6 +8,7 @@ describe("formula evaluator", () => { beforeAll(() => { testDI(stateData) + process.env.TZ = "UTC" subject = new FormulaEvaluator() }) @@ -225,7 +226,7 @@ describe("formula evaluator", () => { NBDBString.toData( subject.startDate(["", ["fromTimestamp", "1641300863123"]]) ) - ).toBe("2022-01-04T21:54") + ).toBe("2022-01-04T12:54") expect(subject.startDate(["", true]).D).toBe(null) }) @@ -251,13 +252,13 @@ describe("formula evaluator", () => { it("timestamp", () => { expect(subject.timestamp(["", "2022-01-08T01:02"]).S).toBe( - "1641571320000" + "1641603720000" ) }) it("fromTimestamp", () => { expect( - NBDBString.toData(subject.fromTimestamp(["", "1641571320000"])) + NBDBString.toData(subject.fromTimestamp(["", "1641603720000"])) ).toBe("2022-01-08T01:02") })