mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 01:54:08 +03:00
chore: fix test
This commit is contained in:
parent
7db7d4fc91
commit
7c06735c6d
|
@ -13,6 +13,7 @@ import {
|
||||||
|
|
||||||
import { OpenAPIParser } from '../../services';
|
import { OpenAPIParser } from '../../services';
|
||||||
import { OpenAPIParameter, OpenAPIParameterLocation, OpenAPIParameterStyle } from '../../types';
|
import { OpenAPIParameter, OpenAPIParameterLocation, OpenAPIParameterStyle } from '../../types';
|
||||||
|
import { expandDefaultServerVariables } from '../openapi';
|
||||||
|
|
||||||
describe('Utils', () => {
|
describe('Utils', () => {
|
||||||
describe('openapi getStatusCode', () => {
|
describe('openapi getStatusCode', () => {
|
||||||
|
@ -297,11 +298,8 @@ describe('Utils', () => {
|
||||||
it('should expand variables', () => {
|
it('should expand variables', () => {
|
||||||
const servers = normalizeServers('', [
|
const servers = normalizeServers('', [
|
||||||
{
|
{
|
||||||
url: '{protocol}{host}{basePath}',
|
url: 'http://{host}{basePath}',
|
||||||
variables: {
|
variables: {
|
||||||
protocol: {
|
|
||||||
default: 'http://',
|
|
||||||
},
|
|
||||||
host: {
|
host: {
|
||||||
default: '127.0.0.1',
|
default: '127.0.0.1',
|
||||||
},
|
},
|
||||||
|
@ -319,9 +317,15 @@ describe('Utils', () => {
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(servers[0].url).toEqual('http://127.0.0.1/path/to/endpoint');
|
expect(expandDefaultServerVariables(servers[0].url, servers[0].variables)).toEqual(
|
||||||
expect(servers[1].url).toEqual('http://127.0.0.2:{port}');
|
'http://127.0.0.1/path/to/endpoint',
|
||||||
expect(servers[2].url).toEqual('http://127.0.0.3');
|
);
|
||||||
|
expect(expandDefaultServerVariables(servers[1].url, servers[1].variables)).toEqual(
|
||||||
|
'http://127.0.0.2:{port}',
|
||||||
|
);
|
||||||
|
expect(expandDefaultServerVariables(servers[2].url, servers[2].variables)).toEqual(
|
||||||
|
'http://127.0.0.3',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user