Skip to content

Commit

Permalink
test(resolver): add tests for OpenAPI 3.1 skipNormalization option
Browse files Browse the repository at this point in the history
Refs #2764
  • Loading branch information
char0n committed Jan 10, 2023
1 parent 79b23ba commit 93915af
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion test/resolver/strategies/openapi-3-1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('resolve', () => {
});
});

describe('and allowMetaPatches=true', () => {
describe('and allowMetaPatches=false', () => {
test('should resolve', async () => {
const url = 'https://example.com/petstore.json';
const response = new Response(
Expand Down Expand Up @@ -132,6 +132,30 @@ describe('resolve', () => {
expect(resolvedSpec).toMatchSnapshot();
});
});

describe('and skipNormalization=true', () => {
test('should resolve and skip normalization', async () => {
const spec = globalThis.loadJsonFile(path.join(fixturePath, 'petstore.json'));
const resolvedSpec = await SwaggerClient.resolve({
spec,
skipNormalization: true,
});

expect(resolvedSpec).toMatchSnapshot();
});
});

describe('and skipNormalization=false', () => {
test('should resolve and normalize', async () => {
const spec = globalThis.loadJsonFile(path.join(fixturePath, 'petstore.json'));
const resolvedSpec = await SwaggerClient.resolve({
spec,
skipNormalization: false,
});

expect(resolvedSpec).toMatchSnapshot();
});
});
});
});
});

0 comments on commit 93915af

Please sign in to comment.