-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathanalyticsEvents.growth.test.js
More file actions
39 lines (34 loc) · 963 Bytes
/
Copy pathanalyticsEvents.growth.test.js
File metadata and controls
39 lines (34 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright (c) 2025 Bayan Flow
* Licensed under Elastic License 2.0 OR Commercial
* See LICENSE for details.
*/
import { describe, it, expect, vi, beforeEach } from 'vitest';
import {
trackWaitlistJoined,
trackUpgradeLimitHit,
WAITLIST_JOINED,
UPGRADE_LIMIT_HIT,
} from './analyticsEvents.js';
import { captureEvent } from './analytics.js';
vi.mock('./analytics.js', () => ({
captureEvent: vi.fn(),
}));
describe('analyticsEvents growth conversions', () => {
beforeEach(() => {
vi.mocked(captureEvent).mockClear();
});
it('tracks waitlist_joined with source and position', () => {
trackWaitlistJoined('pro_page', 3);
expect(captureEvent).toHaveBeenCalledWith(WAITLIST_JOINED, {
source: 'pro_page',
position: 3,
});
});
it('tracks upgrade_limit_hit with limit', () => {
trackUpgradeLimitHit(12);
expect(captureEvent).toHaveBeenCalledWith(UPGRADE_LIMIT_HIT, {
limit: 12,
});
});
});