Added tests for the new endpoint
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
ref #157
This commit is contained in:
parent
8ba7ee1d48
commit
757332ed2b
|
@ -56,4 +56,34 @@ describe('adding + getting stations', () => {
|
|||
expect(res.status).toEqual(200);
|
||||
expect(res.headers['content-type']).toContain("application/json");
|
||||
});
|
||||
});
|
||||
// ---------------
|
||||
describe('adding + getting via me endpoint', () => {
|
||||
let added_track;
|
||||
let added_station;
|
||||
it('creating a track should return 200', async () => {
|
||||
const res1 = await axios.post(base + '/api/tracks', {
|
||||
"name": "test123",
|
||||
"distance": 123
|
||||
}, axios_config);
|
||||
added_track = res1.data
|
||||
expect(res1.status).toEqual(200);
|
||||
expect(res1.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('correct description and track input for station creation return 200', async () => {
|
||||
const res = await axios.post(base + '/api/stations', {
|
||||
"track": added_track.id,
|
||||
"description": "I am but a simple test."
|
||||
}, axios_config);
|
||||
added_station = res.data;
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('correct description and track input for station creation return 200', async () => {
|
||||
const res = await axios.get(base + '/api/stations/0/me', { headers: { "authorization": "Bearer " + added_station.key } });
|
||||
expect(res.status).toEqual(200);
|
||||
expect(res.headers['content-type']).toContain("application/json")
|
||||
added_station.key = "Only visible on creation.";
|
||||
expect(res.data).toEqual(added_station);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue