2017-06-28 10:20:22 +02:00
|
|
|
'use strict';
|
|
|
|
|
2018-12-17 09:24:49 +01:00
|
|
|
const test = require('ava');
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2017-12-18 14:21:11 +01:00
|
|
|
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);
|
|
|
|
});
|