(videoId, orgId = "", index = 0)
| 55 | } |
| 56 | |
| 57 | function generateTestEvent(videoId, orgId = "", index = 0) { |
| 58 | const timestamp = generateRandomTimestamp(30); |
| 59 | const city = randomChoice(CITIES); |
| 60 | const browser = randomChoice(BROWSERS); |
| 61 | const device = randomChoice(DEVICES); |
| 62 | const os = randomChoice(OS_OPTIONS); |
| 63 | const sessionId = generateSessionId( |
| 64 | videoId, |
| 65 | timestamp, |
| 66 | city.name, |
| 67 | browser, |
| 68 | index, |
| 69 | ); |
| 70 | |
| 71 | return { |
| 72 | timestamp, |
| 73 | session_id: sessionId, |
| 74 | tenant_id: orgId, |
| 75 | action: "page_hit", |
| 76 | version: "test_data_v1", |
| 77 | pathname: `/s/${videoId}`, |
| 78 | video_id: videoId, |
| 79 | country: city.country, |
| 80 | region: city.region, |
| 81 | city: city.name, |
| 82 | browser, |
| 83 | device, |
| 84 | os, |
| 85 | }; |
| 86 | } |
| 87 | |
| 88 | function toNdjson(rows) { |
| 89 | return rows.map((r) => JSON.stringify(r)).join("\n"); |
no test coverage detected