Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 65356a8

Browse files
committed
Handle null city in event
1 parent 30006d4 commit 65356a8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/events/event-store.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ const store = new Vuex.Store({
7373
delete event.startTime;
7474
delete event.endTime;
7575

76+
if (event.city == null) {
77+
event.city = {};
78+
}
79+
7680
// This is a workaround for '$$hashKey': 'value' in the json objects of some events.
7781
// This is something from angular tracking its props being persisted somehow.
7882
if (event.city.nameWithHierarchy) {

test/unit/specs/events/event-store.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ describe('Event Store', () => {
7676
sendEmails: false,
7777
});
7878
});
79+
80+
it('handles city being null', () => {
81+
const event = { id: 1, name: 'Event name', city: null };
82+
EventStore.commit('setEvent', event);
83+
84+
expect(EventStore.state.event).to.deep.equal({
85+
id: 1,
86+
name: 'Event name',
87+
city: {},
88+
sendEmails: false,
89+
});
90+
});
7991
});
8092

8193
describe('mutations.setEventName', () => {

0 commit comments

Comments
 (0)