(client: ChClient, projectId: string)
| 180 | } |
| 181 | |
| 182 | async function insertFixtures(client: ChClient, projectId: string) { |
| 183 | const now = new Date(); |
| 184 | |
| 185 | await client.insert({ |
| 186 | table: 'openpanel.profiles', |
| 187 | values: [ |
| 188 | { |
| 189 | id: FIXTURE.profiles.alice, |
| 190 | project_id: projectId, |
| 191 | first_name: 'Alice', |
| 192 | last_name: 'Smith', |
| 193 | email: 'alice@example.com', |
| 194 | avatar: '', |
| 195 | is_external: false, |
| 196 | // browser/country in properties so tests can filter profiles by these fields |
| 197 | properties: { browser: 'Chrome', country: 'US', device: 'desktop' }, |
| 198 | groups: [], |
| 199 | created_at: timeAgo(now, 60), |
| 200 | last_seen_at: timeAgo(now, 1), |
| 201 | }, |
| 202 | { |
| 203 | id: FIXTURE.profiles.bob, |
| 204 | project_id: projectId, |
| 205 | first_name: 'Bob', |
| 206 | last_name: "O'Brien", |
| 207 | email: 'bob@example.com', |
| 208 | avatar: '', |
| 209 | is_external: false, |
| 210 | // Bob is intentionally inactive (no events) — useful for inactiveDays tests |
| 211 | properties: { browser: 'Chrome', country: 'SE', device: 'desktop' }, |
| 212 | groups: [], |
| 213 | created_at: timeAgo(now, 90), |
| 214 | last_seen_at: timeAgo(now, 90), |
| 215 | }, |
| 216 | { |
| 217 | id: FIXTURE.profiles.charlie, |
| 218 | project_id: projectId, |
| 219 | first_name: 'Charlie', |
| 220 | last_name: 'Brown', |
| 221 | email: 'charlie@example.com', |
| 222 | avatar: '', |
| 223 | is_external: false, |
| 224 | properties: { browser: 'Firefox', country: 'US', device: 'desktop' }, |
| 225 | groups: [], |
| 226 | created_at: timeAgo(now, 30), |
| 227 | last_seen_at: timeAgo(now, 5), |
| 228 | }, |
| 229 | ], |
| 230 | format: 'JSONEachRow', |
| 231 | }); |
| 232 | |
| 233 | // Alice: session_start → page_view → session_end (2 days ago, spaced 2 min apart) |
| 234 | // Charlie: session_start → screen_view → page_view → purchase → session_end (5 days ago, spaced 5 min apart) |
| 235 | // Events are spaced so windowFunnel strict_increase mode works correctly. |
| 236 | await client.insert({ |
| 237 | table: 'openpanel.events', |
| 238 | values: [ |
| 239 | buildEvent( |
no test coverage detected