🚧 tracks.spec.ts - sample track adding + getting

ref #17
This commit is contained in:
Philipp Dormann 2020-12-05 20:19:41 +01:00
parent 15e3d04215
commit a671bf8bcb
1 changed files with 12 additions and 1 deletions

View File

@ -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
})
});
});