Compare commits
2 Commits
0b4d30b3f3
...
9ab6eb5314
Author | SHA1 | Date | |
---|---|---|---|
9ab6eb5314 | |||
ce0500ef8c |
34
src/tests/api_docs.spec.ts
Normal file
34
src/tests/api_docs.spec.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import { config } from '../config';
|
||||||
|
const base = "http://localhost:" + config.internal_port
|
||||||
|
|
||||||
|
describe('GET /api/docs/openapi.json', () => {
|
||||||
|
it('OpenAPI Spec is availdable 200', async () => {
|
||||||
|
const res = await axios.get(base + '/api/docs/openapi.json');
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('GET /api/docs/swagger.json', () => {
|
||||||
|
it('OpenAPI Spec is availdable 200', async () => {
|
||||||
|
const res = await axios.get(base + '/api/docs/swagger.json');
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('GET /api/docs/swaggerui', () => {
|
||||||
|
it('swaggerui is availdable 200', async () => {
|
||||||
|
const res = await axios.get(base + '/api/docs/swaggerui');
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('GET /api/docs/redoc', () => {
|
||||||
|
it('redoc is availdable 200', async () => {
|
||||||
|
const res = await axios.get(base + '/api/docs/redoc');
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('GET /api/docs/rapidoc', () => {
|
||||||
|
it('rapidoc is availdable 200', async () => {
|
||||||
|
const res = await axios.get(base + '/api/docs/rapidoc');
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
});
|
||||||
|
});
|
@ -1,35 +0,0 @@
|
|||||||
import axios from 'axios';
|
|
||||||
import { config } from '../config';
|
|
||||||
const base = "http://localhost:" + config.internal_port
|
|
||||||
|
|
||||||
let access_token;
|
|
||||||
let axios_config;
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
|
||||||
const res = await axios.post(base + '/api/auth/login', { username: "demo", password: "demo" });
|
|
||||||
access_token = res.data["access_token"];
|
|
||||||
axios_config = {
|
|
||||||
headers: { "authorization": "Bearer " + access_token },
|
|
||||||
validateStatus: undefined
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('GET /api/openapi.json', () => {
|
|
||||||
it('is http 200', async () => {
|
|
||||||
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(base + '/', axios_config);
|
|
||||||
expect(res.status).toEqual(404);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('GET /api/teams', () => {
|
|
||||||
it('is http 200 && is json', async () => {
|
|
||||||
const res = await axios.get(base + '/api/teams', axios_config);
|
|
||||||
expect(res.status).toEqual(200);
|
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user