diff --git a/jest.config.ts b/jest.config.ts index 3597688..9bd7e29 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -10,6 +10,7 @@ const jestConfig = { modulePathIgnorePatterns: ['/node_modules/', '/test/sgp4/sgp4prop'], coverageReporters: ['lcov', 'html', 'text'], coveragePathIgnorePatterns: ['/node_modules/', '/dist/', '/lib/', '/commonjs/', '/test/', '/scripts/', '/coverage/'], + globalSetup: '/test/lib/globalSetup.js', }; export default jestConfig; diff --git a/test/body/Moon.test.ts b/test/body/Moon.test.ts index 0a8fad8..f0039e3 100644 --- a/test/body/Moon.test.ts +++ b/test/body/Moon.test.ts @@ -150,7 +150,7 @@ describe('Moon', () => { * 'rise', 'set', 'ye', 'alwaysUp', 'alwaysDown', and 'highest' properties. */ it('should return with \'rise\', \'set\', \'ye\', \'alwaysUp\', \'alwaysDown\', and \'highest\' properties', () => { - const date = exampleDate; + const date = new Date(exampleDate.getTime() - exampleDate.getTimezoneOffset() * 60000); const lat = 37.7749 as Degrees; // San Francisco latitude const lon = -122.4194 as Degrees; // San Francisco longitude const isUtc = false; diff --git a/test/lib/globalSetup.js b/test/lib/globalSetup.js new file mode 100644 index 0000000..50cafd7 --- /dev/null +++ b/test/lib/globalSetup.js @@ -0,0 +1,4 @@ +export default () => { + // eslint-disable-next-line no-process-env + process.env.TZ = 'EST'; +}; diff --git a/test/lib/globalSetup.test.ts b/test/lib/globalSetup.test.ts new file mode 100644 index 0000000..faab26f --- /dev/null +++ b/test/lib/globalSetup.test.ts @@ -0,0 +1,6 @@ +describe('Timezones', () => { + it('should always be EST', () => { + // This is so that we can check local and utc calculations + expect(new Date().getTimezoneOffset()).toBe(300); + }); +});