(data: ImpactMetricsBody = {}, status = 202)
| 19 | }; |
| 20 | |
| 21 | const sendMetrics = async (data: ImpactMetricsBody = {}, status = 202) => { |
| 22 | const { impactMetrics = [] } = data; |
| 23 | const body: Record<string, unknown> = { |
| 24 | appName: 'impact-metrics-app', |
| 25 | instanceId: 'instance-id', |
| 26 | impactMetrics, |
| 27 | }; |
| 28 | // bucket defaults to null when the key is omitted; passing `bucket: undefined` |
| 29 | // explicitly drops it from the body. |
| 30 | const bucket = 'bucket' in data ? data.bucket : null; |
| 31 | if (bucket !== undefined) { |
| 32 | body.bucket = bucket; |
| 33 | } |
| 34 | return app.request.post('/api/client/metrics').send(body).expect(status); |
| 35 | }; |
| 36 | |
| 37 | const sendBulkMetricsWithImpact = async ( |
| 38 | impactMetrics: (NumericMetric | BucketMetric)[], |
no test coverage detected