From 34fa94ea4f896ad17b6a8759f61ecb7fba095d53 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 9 Dec 2020 16:10:17 +0100 Subject: [PATCH] First tests for orgs ref #17 --- src/tests/runnerGroups/org.spec.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/tests/runnerGroups/org.spec.ts diff --git a/src/tests/runnerGroups/org.spec.ts b/src/tests/runnerGroups/org.spec.ts new file mode 100644 index 0000000..e5387ea --- /dev/null +++ b/src/tests/runnerGroups/org.spec.ts @@ -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") + }); +}); \ No newline at end of file