1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/test/e2e/api/client/metrics.e2e.test.js
Ivar Conradi Østhus d01c9d2dac
fix: use airbnb lint rules directly (#583)
This drops usage of finn-eslint rules as they are no
longer maintained.
2020-04-14 22:29:11 +02:00

40 lines
975 B
JavaScript

'use strict';
const test = require('ava');
const { setupApp } = require('../../helpers/test-helper');
const metricsExample = require('../../../examples/client-metrics.json');
const dbInit = require('../../helpers/database-init');
const getLogger = require('../../../fixtures/no-logger');
let stores;
test.before(async () => {
const db = await dbInit('metrics_api_client', getLogger);
stores = db.stores;
});
test.after(async () => {
await stores.db.destroy();
});
test.serial('should be possble to send metrics', async t => {
t.plan(0);
const request = await setupApp(stores);
return request
.post('/api/client/metrics')
.send(metricsExample)
.expect(202);
});
test.serial('should require valid send metrics', async t => {
t.plan(0);
const request = await setupApp(stores);
return request
.post('/api/client/metrics')
.send({
appName: 'test',
})
.expect(400);
});