Skip to content

Commit

Permalink
fix: time zone issue in unit tests
Browse files Browse the repository at this point in the history
affects: @medly-components/forms
  • Loading branch information
gmukul01 committed Jul 20, 2024
1 parent a4e4442 commit 05ff7af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions global-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = async () => {
process.env.TZ = 'UTC';
};
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
projects: ['core', 'layout', 'forms', 'icons', 'utils'].map(name => ({
displayName: name,
setupFilesAfterEnv: ['<rootDir>/jest.setupAfterEnv.js'],
globalSetup: '<rootDir>/global-setup.js',
moduleNameMapper: {
'^@test-utils': '<rootDir>/test-utils',
'^@medly-components/(.*)$': '<rootDir>/packages/$1/src/index'
Expand Down
4 changes: 2 additions & 2 deletions packages/forms/src/components/Form/Form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ describe('Form', () => {
it('with onChangeFormatter', async () => {
const mockOnSubmit = jest.fn(),
formData = {
birthDate: '2024-07-19T00:00:00+05:30'
birthDate: '2024-07-19T00:00:00Z'
};
render(
<Form
Expand All @@ -353,7 +353,7 @@ describe('Form', () => {
}}
onSubmit={mockOnSubmit}
initialState={{
birthDate: '2024-07-18T00:00:00+05:30'
birthDate: '2024-07-18T00:00:00Z'
}}
/>
);
Expand Down

0 comments on commit 05ff7af

Please sign in to comment.