APIドキュメントが見れなくなっているのを修正など (#7500)

* Test api.json

* Fix typo

* Fix api-doc
This commit is contained in:
MeiMei
2021-05-05 19:02:30 +09:00
committed by GitHub
parent 80f8c2de78
commit 588b838deb
5 changed files with 83 additions and 12 deletions

View File

@ -12,7 +12,8 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
import { async, launchServer, signup, post, request, simpleGet } from './utils';
import { async, launchServer, signup, post, request, simpleGet, port } from './utils';
import * as openapi from '@redocly/openapi-core';
// Request Accept
const ONLY_AP = 'application/activity+json';
@ -74,6 +75,20 @@ describe('Fetch resource', () => {
assert.strictEqual(res.type, JSON);
}));
it('Validate api.json', async(async () => {
const config = await openapi.loadConfig();
const result = await openapi.bundle({
config,
ref: `http://localhost:${port}/api.json`
});
for (const problem of result.problems) {
console.log(`${problem.message} - ${problem.location[0]?.pointer}`);
}
assert.strictEqual(result.problems.length, 0);
}));
it('GET favicon.ico', async(async () => {
const res = await simpleGet('/favicon.ico');
assert.strictEqual(res.status, 200);