⚙ use new config loader

ref #18 ,ref #17
This commit is contained in:
Philipp Dormann 2020-12-06 10:48:25 +01:00
parent 2cdc91ec83
commit 39cefbc593
2 changed files with 7 additions and 5 deletions

View File

@ -1,21 +1,22 @@
import axios from 'axios'; import axios from 'axios';
import { config } from '../config';
const base = "http://localhost:" + config.internal_port
describe('GET /api/openapi.json', () => { describe('GET /api/openapi.json', () => {
it('is http 200', async () => { 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); expect(res.status).toEqual(200);
}); });
}); });
describe('GET /', () => { describe('GET /', () => {
it('is http 404', async () => { 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); expect(res.status).toEqual(404);
}); });
}); });
describe('GET /api/teams', () => { describe('GET /api/teams', () => {
it('is http 200 && is json', async () => { it('is http 200 && is json', async () => {
const res = await axios.get('http://localhost:4010/api/teams', { validateStatus: undefined }); const res = await axios.get(base + '/api/teams', { validateStatus: undefined });
console.log(res.headers);
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")
}); });

View File

@ -1,5 +1,6 @@
import axios from 'axios'; import axios from 'axios';
const base = "http://localhost:4010" import { config } from '../config';
const base = "http://localhost:" + config.internal_port
describe('GET /api/tracks', () => { describe('GET /api/tracks', () => {
it('basic get should return 200', async () => { it('basic get should return 200', async () => {