From 39cefbc593a057393c59de96d2b7153adb5ea7a5 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sun, 6 Dec 2020 10:48:25 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=20use=20new=20config=20loader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #18 ,ref #17 --- src/tests/firsttest.spec.ts | 9 +++++---- src/tests/tracks.spec.ts | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tests/firsttest.spec.ts b/src/tests/firsttest.spec.ts index 13492eb..27c84d3 100644 --- a/src/tests/firsttest.spec.ts +++ b/src/tests/firsttest.spec.ts @@ -1,21 +1,22 @@ import axios from 'axios'; +import { config } from '../config'; +const base = "http://localhost:" + config.internal_port describe('GET /api/openapi.json', () => { it('is http 200', async () => { - const res = await axios.get('http://localhost:4010/api/openapi.json'); + const res = await axios.get(base + '/api/openapi.json'); expect(res.status).toEqual(200); }); }); describe('GET /', () => { it('is http 404', async () => { - const res = await axios.get('http://localhost:4010/', { validateStatus: undefined }); + const res = await axios.get(base + '/', { validateStatus: undefined }); expect(res.status).toEqual(404); }); }); describe('GET /api/teams', () => { it('is http 200 && is json', async () => { - const res = await axios.get('http://localhost:4010/api/teams', { validateStatus: undefined }); - console.log(res.headers); + const res = await axios.get(base + '/api/teams', { validateStatus: undefined }); expect(res.status).toEqual(200); expect(res.headers['content-type']).toContain("application/json") }); diff --git a/src/tests/tracks.spec.ts b/src/tests/tracks.spec.ts index 3f8312a..b29294c 100644 --- a/src/tests/tracks.spec.ts +++ b/src/tests/tracks.spec.ts @@ -1,5 +1,6 @@ import axios from 'axios'; -const base = "http://localhost:4010" +import { config } from '../config'; +const base = "http://localhost:" + config.internal_port describe('GET /api/tracks', () => { it('basic get should return 200', async () => {