Skip to content

Commit

Permalink
Add UserTimezone tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KuSh committed Oct 29, 2024
1 parent 80f7200 commit f38c5b6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -791,3 +791,9 @@ exports[`<FormattedDate/> should match snapshot for 'zh-TW' locale and 'undefine
2024年10月26日
</Text>
`;

exports[`<FormattedDate/> should render with a manual user time 1`] = `
<Text>
Oct 26, 2024
</Text>
`;
30 changes: 30 additions & 0 deletions app/components/formatted_date/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,34 @@ describe('<FormattedDate/>', () => {
);
expect(wrapper.toJSON()).toMatchSnapshot();
});

it('should render with a manual user time', () => {
const wrapper = renderWithIntl(
<FormattedDate
value={DATE}
timezone={{
automaticTimezone: '',
manualTimezone: 'Indian/Mauritius',
useAutomaticTimezone: '',
}}
/>,
);
expect(wrapper.toJSON()).toMatchSnapshot();
});

it('should render with an automatic user time', () => {
const wrapper = renderWithIntl(
<FormattedDate
value={DATE}
timezone={{
automaticTimezone: 'Indian/Mauritius',
manualTimezone: '',
useAutomaticTimezone: 'true',
}}
/>,
);

// Just check that the component render as automatic timezone is environment dependant
expect(wrapper.toJSON()).toBeTruthy();
});
});

0 comments on commit f38c5b6

Please sign in to comment.