diff --git a/src/tests/scanstations/scanstations_get.spec.ts b/src/tests/scanstations/scanstations_get.spec.ts index 7280c31..9aff25b 100644 --- a/src/tests/scanstations/scanstations_get.spec.ts +++ b/src/tests/scanstations/scanstations_get.spec.ts @@ -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); + }); }); \ No newline at end of file