API Integration Tests via jest (#10899)

* tests: experiment with api tests

* api tests are getting nice

* api: api testing ready for feedback
This commit is contained in:
Torkel Ödegaard
2018-02-14 10:26:20 +01:00
committed by GitHub
parent bb681cd498
commit ead1c300d7
11 changed files with 373 additions and 3 deletions

27
tests/api/search.test.ts Normal file
View File

@@ -0,0 +1,27 @@
import client from './client';
import * as setup from './setup';
describe('GET /api/search', () => {
const state = {};
beforeAll(async () => {
state = await setup.ensureState({
orgName: 'api-test-org',
users: [{ user: setup.admin, role: 'Admin' }],
admin: setup.admin,
dashboards: [
{
title: 'Dashboard in root no permissions',
uid: 'AAA',
},
],
});
});
describe('With admin user', () => {
it('should return all dashboards', async () => {
let rsp = await client.callAs(state.admin).get('/api/search');
expect(rsp.data).toHaveLength(1);
});
});
});