summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2021-05-05 19:02:30 +0900
committerGitHub <noreply@github.com>2021-05-05 19:02:30 +0900
commit588b838debb6616cfaf597bbfa1a8eb00576dcb1 (patch)
treea3c97f53f768aa34f09daa26b2f717f0a828b9f6 /test
parent12.80.2 (diff)
downloadsharkey-588b838debb6616cfaf597bbfa1a8eb00576dcb1.tar.gz
sharkey-588b838debb6616cfaf597bbfa1a8eb00576dcb1.tar.bz2
sharkey-588b838debb6616cfaf597bbfa1a8eb00576dcb1.zip
APIドキュメントが見れなくなっているのを修正など (#7500)
* Test api.json * Fix typo * Fix api-doc
Diffstat (limited to 'test')
-rw-r--r--test/fetch-resource.ts17
-rw-r--r--test/utils.ts2
2 files changed, 17 insertions, 2 deletions
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(() => {