From 588b838debb6616cfaf597bbfa1a8eb00576dcb1 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Wed, 5 May 2021 19:02:30 +0900 Subject: APIドキュメントが見れなくなっているのを修正など (#7500) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Test api.json * Fix typo * Fix api-doc --- test/fetch-resource.ts | 17 ++++++++++++++++- test/utils.ts | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/fetch-resource.ts b/test/fetch-resource.ts index 12a37b6cb0..79a5519ddb 100644 --- a/test/fetch-resource.ts +++ b/test/fetch-resource.ts @@ -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); diff --git a/test/utils.ts b/test/utils.ts index b0393ee192..193017e265 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -6,7 +6,7 @@ import * as childProcess from 'child_process'; import * as http from 'http'; import loadConfig from '../src/config/load'; -const port = loadConfig().port; +export const port = loadConfig().port; export const async = (fn: Function) => (done: Function) => { fn().then(() => { -- cgit v1.2.3-freya