parent
07e03ff04e
commit
15e3d04215
@ -2,7 +2,7 @@ import axios from 'axios';
|
|||||||
|
|
||||||
describe('GET /api/tracks', () => {
|
describe('GET /api/tracks', () => {
|
||||||
it('basic get should return 200', async () => {
|
it('basic get should return 200', async () => {
|
||||||
const res = await axios.get('http://localhost:4010/api/tracks', { validateStatus: undefined });
|
const res = await axios.get('http://localhost:4010/api/tracks');
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
@ -10,7 +10,7 @@ describe('GET /api/tracks', () => {
|
|||||||
const res = await axios.post('http://localhost:4010/api/tracks', {
|
const res = await axios.post('http://localhost:4010/api/tracks', {
|
||||||
"name": "string",
|
"name": "string",
|
||||||
"distance": 400
|
"distance": 400
|
||||||
}, { validateStatus: undefined });
|
});
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
@ -29,8 +29,19 @@ describe('POST /api/tracks', () => {
|
|||||||
const res = await axios.post('http://localhost:4010/api/tracks', {
|
const res = await axios.post('http://localhost:4010/api/tracks', {
|
||||||
"name": "string",
|
"name": "string",
|
||||||
"distance": 400
|
"distance": 400
|
||||||
}, { validateStatus: undefined });
|
});
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
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);
|
||||||
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
|
let added_track = res.data[res.data.length - 1]
|
||||||
|
delete added_track.id
|
||||||
|
expect(added_track).toEqual({
|
||||||
|
"name": "string",
|
||||||
|
"distance": 400
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user