1
0
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:
ivaosthu 2017-12-18 14:21:11 +01:00 committed by Ivar Conradi Østhus
parent 9d948b68c4
commit 2ba3823de0
2 changed files with 42 additions and 1 deletions

View File

@ -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);
});

View 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
}
}
}
}