High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
Fix timezone mismatch in server tests (#1918)
Sergey Kondrikov82e8cd0f8d1a
diff --git a/server/libs/common/src/utils/time-utils.spec.ts b/server/libs/common/src/utils/time-utils.spec.tsindex fd1ed933ec..31cd4b6537 100644--- a/server/libs/common/src/utils/time-utils.spec.ts+++ b/server/libs/common/src/utils/time-utils.spec.ts@@ -3,6 +3,12 @@import { timeUtils } from './time-utils';describe('Time Utilities', () => {+ describe('timezone', () => {+ it('should always be UTC', () => {+ expect(new Date().getTimezoneOffset()).toBe(0);+ });+ });+describe('checkValidTimestamp', () => {it('check for year 0000', () => {const result = timeUtils.checkValidTimestamp('0000-00-00T00:00:00.000Z');diff --git a/server/libs/domain/test/global-setup.js b/server/libs/domain/test/global-setup.jsnew file mode 100644index 0000000000..6e1fbf41d0--- /dev/null+++ b/server/libs/domain/test/global-setup.js@@ -0,0 +1,3 @@+module.exports = async () => {+ process.env.TZ = 'UTC';+};diff --git a/server/package.json b/server/package.jsonindex 12fa9757e2..1e3b8f9105 100644--- a/server/package.json+++ b/server/package.json@@ -160,6 +160,7 @@"@app/common": "<rootDir>/libs/common/src","^@app/infra(|/.*)$": "<rootDir>/libs/infra/src/$1","^@app/domain(|/.*)$": "<rootDir>/libs/domain/src/$1"- }+ },+ "globalSetup": "<rootDir>/libs/domain/test/global-setup.js"}}