summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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(() => {