Skip to content
Myr

chore(tests): use UTC date string in tests to be timezone independent (#705)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Previously tests could break when run in a different timezone.

authored by Grzegorz Rozdzialik · committed by GitHub · parent fe8f589 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • tests:+2 added−2 removed

1 file+2 added−2 removed

modified:__tests__/patch.js+2 added-2 removed
1129 unmodified lines
1130 }1131 }11321133 const [nextState, patches] = produceWithPatches({}, function(draft) {1134 draft.date = new Date(2020, 10, 10, 8, 8, 8, 3)1134 draft.date = new Date("2020-11-10T08:08:08.003Z")1135 draft.test = new Test()1136 })11371138 expect(nextState.date.toJSON()).toMatchInlineSnapshot(
5 unmodified lines
1144 expect(rebuilt.date).toBeInstanceOf(Date)1145 expect(rebuilt.date.toJSON()).toMatchInlineSnapshot(1146 `"2020-11-10T08:08:08.003Z"`1147 )1148 expect(rebuilt.date).toEqual(new Date(2020, 10, 10, 8, 8, 8, 3))1148 expect(rebuilt.date).toEqual(new Date("2020-11-10T08:08:08.003Z"))1149})