UNPKG

parse-openapi

Version:

OpenAPI v3 parser

56 lines (55 loc) 1.59 kB
"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 getRef_1 = require("./getRef"); (0, uvu_1.test)('getRef should produce correct result', () => { strict_1.default.deepEqual((0, getRef_1.getRef)({ openapi: '3.0', info: { title: 'dummy', version: '1.0', }, paths: {}, servers: [ { url: 'https://localhost:8080/api', }, ], components: { schemas: { Example: { description: 'This is an Example model ', type: 'integer', }, }, }, }, { $ref: '#/components/schemas/Example', }), { description: 'This is an Example model ', type: 'integer', }); }); (0, uvu_1.test)('getRef should produce correct result for encoded ref path', () => { strict_1.default.deepEqual((0, getRef_1.getRef)({ openapi: '3.0', info: { title: 'dummy', version: '1.0', }, paths: { '/api/user/{id}': { description: 'This is an Example path', }, }, }, { $ref: '#/paths/~1api~1user~1%7Bid%7D', }), { description: 'This is an Example path', }); }); uvu_1.test.run();