openapi-modifier
Version:
This package allows you to automate the process of modifying OpenAPI specifications by applying a set of predefined rules
26 lines (25 loc) • 803 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const refs_1 = require("./refs");
describe('checkIsRefSchema', () => {
test.each([
[{ $ref: '#' }, true],
[{}, false],
[null, false],
[undefined, false],
[123, false],
['123', false],
[NaN, false],
])('checkIsRefSchema(%s)', (schema, expectedResult) => {
expect((0, refs_1.checkIsRefSchema)(schema)).toEqual(expectedResult);
});
});
describe('tryExtractRefLastPath', () => {
test.each([
['#/component/TestRef', 'TestRef'],
['#/component/TestRef/', null],
['', null],
])('tryExtractRefLastPath(%s)', (ref, expectedResult) => {
expect((0, refs_1.tryExtractRefLastPath)(ref)).toEqual(expectedResult);
});
});