parse-openapi
Version:
OpenAPI v3 parser
48 lines (47 loc) • 1.44 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const uvu_1 = require("uvu");
const strict_1 = __importDefault(require("assert/strict"));
const getServer_1 = require("./getServer");
(0, uvu_1.test)('getServer should produce correct result', () => {
strict_1.default.deepEqual((0, getServer_1.getServer)({
openapi: '3.0',
info: {
title: 'dummy',
version: '1.0',
},
paths: {},
servers: [
{
url: 'https://localhost:8080/api',
},
],
}), 'https://localhost:8080/api');
});
(0, uvu_1.test)('getServer should produce correct result with variables', () => {
strict_1.default.deepEqual((0, getServer_1.getServer)({
openapi: '3.0',
info: {
title: 'dummy',
version: '1.0',
},
paths: {},
servers: [
{
url: '{scheme}://localhost:{port}/api',
variables: {
scheme: {
default: 'https',
},
port: {
default: '8080',
},
},
},
],
}), 'https://localhost:8080/api');
});
uvu_1.test.run();