(events: Event[])
| 220 | } |
| 221 | |
| 222 | function insertFakeEvents(events: Event[]) { |
| 223 | const blueprint = { |
| 224 | headers: { |
| 225 | 'openpanel-client-id': '5b679c47-9ec0-470a-8944-a9ab8f42b14f', |
| 226 | 'x-client-ip': '229.145.77.175', |
| 227 | 'user-agent': |
| 228 | 'Opera/13.66 (Macintosh; Intel Mac OS X 10.8.3 U; GV Presto/2.9.183 Version/11.00)', |
| 229 | origin: 'https://classic-hovel.info', |
| 230 | }, |
| 231 | track: { |
| 232 | type: 'track', |
| 233 | payload: { |
| 234 | name: 'screen_view', |
| 235 | properties: { |
| 236 | __referrer: 'https://www.google.com', |
| 237 | __path: 'https://classic-hovel.info/beneficium-arcesso-quisquam', |
| 238 | __title: 'Hic thesis laboriosam copiose admoveo sufficio.', |
| 239 | }, |
| 240 | }, |
| 241 | }, |
| 242 | }; |
| 243 | const newEvents = []; |
| 244 | for (const event of events) { |
| 245 | (event.track.payload.properties as any).__group = generateId(); |
| 246 | newEvents.push(event); |
| 247 | |
| 248 | if (event.track.payload.name === 'screen_view' && Math.random() < 0.5) { |
| 249 | const fakeEvent = JSON.parse(JSON.stringify(blueprint)); |
| 250 | fakeEvent.track.payload.name = faker.allFakers.en.lorem.word(); |
| 251 | fakeEvent.headers = event.headers; |
| 252 | delete fakeEvent.track.payload.properties; |
| 253 | newEvents.push(fakeEvent); |
| 254 | fakeEvent.track.payload.properties = { |
| 255 | __group: (event.track.payload.properties as any).__group, |
| 256 | }; |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | return newEvents; |
| 261 | } |
| 262 | |
| 263 | async function simultaneousRequests() { |
| 264 | await getRedisCache().flushdb(); |
no test coverage detected