Skip to content

Commit dc1724e

Browse files
committed
updated e2e test
1 parent a84ae1e commit dc1724e

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

‎packages/analytics-service/test/analytics.e2e-spec.ts‎

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -668,24 +668,41 @@ describe('Analytics Service Viewer Tests', () => {
668668
configEnvironment: 'test',
669669
} as AnalyticsProto.CustomEventTypeRequest;
670670

671-
const response: AnalyticsProto.CustomEventTypeResponse =
671+
const response: AnalyticsProto.GetAllCustomEventTypeResponse =
672672
await new Promise((resolve, reject) => {
673-
analyticsClient.getCustomEventTypes(request, (err, response) => {
673+
analyticsClient.getCustomEventTypes(request, (err, result) => {
674674
if (err) {
675675
reject(err);
676676
} else {
677-
resolve(response);
677+
resolve(result);
678678
}
679679
});
680680
});
681681

682682
expect(response).toBeDefined();
683-
expect(response.id).toBe('custom-event-type-1');
684-
expect(response.category).toBe('user-action');
685-
expect(response.subcategory).toBe('form-submission');
686-
expect(response.properties).toContain('formType');
687-
expect(response.properties).toContain('userId');
688-
expect(response.projectId).toBe('test-project-id');
683+
expect(response.eventTypes).toBeDefined();
684+
if (!response.eventTypes) {
685+
fail('Expected eventTypes to be defined');
686+
return;
687+
}
688+
expect(response.eventTypes.length).toBe(2);
689+
690+
const [firstEventType, secondEventType] = response.eventTypes;
691+
692+
if (!firstEventType || !secondEventType) {
693+
fail('Expected at least two event types in response');
694+
return;
695+
}
696+
697+
expect(firstEventType.id).toBe('custom-event-type-1');
698+
expect(firstEventType.category).toBe('user-action');
699+
expect(firstEventType.subcategory).toBe('form-submission');
700+
expect(firstEventType.properties).toContain('formType');
701+
expect(firstEventType.properties).toContain('userId');
702+
expect(firstEventType.projectId).toBe('test-project-id');
703+
704+
expect(secondEventType.id).toBe('custom-event-type-2');
705+
expect(secondEventType.subcategory).toBe('button-click');
689706
});
690707

691708
it('should fail to get custom event types with invalid api key', async () => {

0 commit comments

Comments
 (0)