mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
Add e2e test for client metrics
This commit is contained in:
parent
9d948b68c4
commit
2ba3823de0
@ -2,4 +2,27 @@
|
||||
|
||||
const { test } = require('ava');
|
||||
|
||||
test.todo('e2e client metrics');
|
||||
const { setupApp } = require('./../../helpers/test-helper');
|
||||
const metricsExample = require('../../../examples/client-metrics.json');
|
||||
|
||||
test.serial('should be possble to send metrics', async t => {
|
||||
t.plan(0);
|
||||
const { request, destroy } = await setupApp('metrics_api_client');
|
||||
return request
|
||||
.post('/api/client/metrics')
|
||||
.send(metricsExample)
|
||||
.expect(202)
|
||||
.then(destroy);
|
||||
});
|
||||
|
||||
test.serial('should require valid send metrics', async t => {
|
||||
t.plan(0);
|
||||
const { request, destroy } = await setupApp('metrics_api_client');
|
||||
return request
|
||||
.post('/api/client/metrics')
|
||||
.send({
|
||||
appName: 'test',
|
||||
})
|
||||
.expect(400)
|
||||
.then(destroy);
|
||||
});
|
||||
|
18
test/examples/client-metrics.json
Normal file
18
test/examples/client-metrics.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"appName": "appName",
|
||||
"instanceId": "instanceId",
|
||||
"bucket": {
|
||||
"start": "2016-11-03T07:16:43.572Z",
|
||||
"stop": "2016-11-03T07:16:53.572Z",
|
||||
"toggles": {
|
||||
"toggle-name-1": {
|
||||
"yes": 123,
|
||||
"no": 321
|
||||
},
|
||||
"toggle-name-2": {
|
||||
"yes": 111,
|
||||
"no": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user