Skip to content

Commit

Permalink
refactor(tests): remove unnecessary moment-timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding-SE committed Jun 26, 2020
1 parent 52e78d9 commit 58df4a7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"jsdom": "^16.2.2",
"jsdom-global": "^3.0.2",
"lerna": "^3.22.0",
"moment-timezone": "^0.5.31",
"ts-jest": "^26.1.0",
"typescript": "^3.9.5"
},
Expand Down
1 change: 0 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"copyfiles": "^2.3.0",
"cross-env": "^7.0.2",
"mini-css-extract-plugin": "^0.9.0",
"moment-timezone": "^0.5.31",
"node-sass": "4.14.1",
"nodemon": "^2.0.4",
"npm-run-all": "^4.1.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as moment from 'moment-timezone';

import { Column } from '../../interfaces/index';
import { Formatters } from '../index';

Expand Down Expand Up @@ -29,9 +27,7 @@ describe('the Date ISO Formatter', () => {
});

it('should return a formatted date value without time date provided has TZ but we specifically mention to parse as UTC ', () => {
moment.tz.setDefault('America/New_York');
// @ts-ignore
const value = moment('2099-12-31T00:00:00.000Z');
const value = new Date('2099-12-31T00:00:00.000Z');

const result1 = Formatters.dateIso(0, 0, value, { params: { parseDateAsUtc: true } } as Column, {});
const result2 = Formatters.dateIso(0, 0, value, { params: { parseDateAsUtc: false } } as Column, {});
Expand Down
3 changes: 3 additions & 0 deletions test/jest-global-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = async () => {
process.env.TZ = 'EST';
};
1 change: 1 addition & 0 deletions test/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
tsConfig: '<rootDir>/test/tsconfig.spec.json'
},
},
globalSetup: '<rootDir>/test/jest-global-setup.js',
collectCoverage: false,
collectCoverageFrom: [
'packages/**/*.ts',
Expand Down

0 comments on commit 58df4a7

Please sign in to comment.