First tests for orgs

ref #17
This commit is contained in:
Nicolai Ort 2020-12-09 16:10:17 +01:00
parent 39cefbc593
commit 34fa94ea4f
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
import axios from 'axios';
import { config } from '../../config';
const base = "http://localhost:" + config.internal_port
describe('GET /api/organisations', () => {
it('basic get should return 200', async () => {
const res = await axios.get(base + '/api/organisations');
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
});
// ---------------
describe('POST /api/organisation', () => {
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisation', {
"name": "test123"
});
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with without a name should return 400', async () => {
const res = await axios.post(base + '/api/organisation', {
"name": null
});
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json")
});
});