From a671bf8bcbfee3af07d5f4b667d5484e69eb9afe Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sat, 5 Dec 2020 20:19:41 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20tracks.spec.ts=20-=20sample=20tr?= =?UTF-8?q?ack=20adding=20+=20getting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #17 --- src/tests/tracks.spec.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tests/tracks.spec.ts b/src/tests/tracks.spec.ts index 6774742..a196e5b 100644 --- a/src/tests/tracks.spec.ts +++ b/src/tests/tracks.spec.ts @@ -33,6 +33,17 @@ describe('POST /api/tracks', () => { expect(res.status).toEqual(200); expect(res.headers['content-type']).toContain("application/json") }); +}); +// --------------- +describe('adding + getting tracks', () => { + it('correct distance input should return 200', async () => { + const res = await axios.post('http://localhost:4010/api/tracks', { + "name": "string", + "distance": 1000 + }); + expect(res.status).toEqual(200); + expect(res.headers['content-type']).toContain("application/json") + }); it('check if track was added', async () => { const res = await axios.get('http://localhost:4010/api/tracks'); expect(res.status).toEqual(200); @@ -41,7 +52,7 @@ describe('POST /api/tracks', () => { delete added_track.id expect(added_track).toEqual({ "name": "string", - "distance": 400 + "distance": 1000 }) }); });