28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
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")
|
|
});
|
|
}); |