JSON.stringify event data.

ARCH-492
This commit is contained in:
Robert Raposa
2019-03-06 16:48:03 -05:00
parent db91f69cdf
commit dc6366a015
2 changed files with 2 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ function logEvent(eventType, eventData) {
const snakeEventData = snakeCaseObject(eventData, { deep: true });
const serverData = {
event_type: eventType,
event: snakeEventData,
event: JSON.stringify(snakeEventData),
page: window.location.href,
};
return apiClient.post(eventLogApiBaseUrl, serverData)

View File

@@ -32,12 +32,7 @@ describe('analytics logEvent', () => {
expect(apiClient.post.mock.calls[0][0]).toEqual(`${configuration.LMS_BASE_URL}/event`);
expect(apiClient.post.mock.calls[0][1]).toEqual({
event_type: 'test.event',
event: {
test_shallow: 'test-shallow',
test_object: {
test_deep: 'test-deep',
},
},
event: '{"test_shallow":"test-shallow","test_object":{"test_deep":"test-deep"}}',
page: window.location.href,
});
});