Commit a4e13d6f authored by Andrew Fontaine's avatar Andrew Fontaine

Add Assert that Timezone is Formatted Properly

The fixture generation of deploy freezes does not guarantee ordering, so
instead we can create a minimal map of the timezones we expect to assert
against.

This also uncovered a small issue where the timezone identifier was
somehow lost. It seems it was not used, but it would still be better to
save it instead of setting it to undefined.
parent de81104f
......@@ -7,7 +7,7 @@ const formatTimezoneName = (freezePeriod, timezoneList) =>
cron_timezone: {
formattedTimezone: timezoneList.find((tz) => tz.identifier === freezePeriod.cron_timezone)
?.name,
identifier: freezePeriod.cronTimezone,
identifier: freezePeriod.cron_timezone,
},
});
......
......@@ -27,15 +27,19 @@ describe('Deploy freeze mutations', () => {
describe('RECEIVE_FREEZE_PERIODS_SUCCESS', () => {
it('should set freeze periods and format timezones from identifiers to names', () => {
const timezoneNames = ['Eastern Time (US & Canada)', 'UTC', 'Berlin'];
const timezoneNames = {
'Europe/Berlin': 'Berlin',
'Etc/UTC': 'UTC',
'America/New_York': 'Eastern Time (US & Canada)',
};
mutations[types.RECEIVE_FREEZE_PERIODS_SUCCESS](stateCopy, freezePeriodsFixture);
const expectedFreezePeriods = freezePeriodsFixture.map((freezePeriod, index) => ({
const expectedFreezePeriods = freezePeriodsFixture.map((freezePeriod) => ({
...convertObjectPropsToCamelCase(freezePeriod),
cronTimezone: {
formattedTimezone: timezoneNames[index],
identifier: freezePeriod.cronTimezone,
formattedTimezone: timezoneNames[freezePeriod.cron_timezone],
identifier: freezePeriod.cron_timezone,
},
}));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment