Skip to content

Commit 2c54423

Browse files
committed
test: simplify fixture and move to appropriate location
1 parent 6a3a4e7 commit 2c54423

File tree

4 files changed

+27
-129
lines changed

4 files changed

+27
-129
lines changed

test/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/all-of.js

+27
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,33 @@ describe('dereference', () => {
184184
});
185185
});
186186

187+
test.only('should resolve allOf hidden behind a reference', async () => {
188+
const spec = OpenApi3_1Element.refract({
189+
openapi: '3.1.0',
190+
components: {
191+
schemas: {
192+
Bar: { $ref: '#/components/schemas/Foo' },
193+
Foo: {
194+
allOf: [{ type: 'object' }],
195+
},
196+
},
197+
},
198+
});
199+
const dereferenced = await dereferenceApiDOM(spec, {
200+
parse: { mediaType: mediaTypes.latest('json') },
201+
});
202+
203+
expect(toValue(dereferenced)).toEqual({
204+
openapi: '3.1.0',
205+
components: {
206+
schemas: {
207+
Bar: { type: 'object' },
208+
Foo: { type: 'object' },
209+
},
210+
},
211+
});
212+
});
213+
187214
test("shouldn't override properties of target Schema Object", async () => {
188215
const spec = OpenApi3_1Element.refract({
189216
openapi: '3.1.0',

test/resolver/strategies/openapi-3-1-apidom/__fixtures__/ref-all-of.json

-45
This file was deleted.

test/resolver/strategies/openapi-3-1-apidom/__snapshots__/index.js.snap

-73
Original file line numberDiff line numberDiff line change
@@ -3101,79 +3101,6 @@ exports[`resolve OpenAPI 3.1.0 strategy given OpenAPI 3.1.0 definition via spec
31013101
}
31023102
`;
31033103

3104-
exports[`resolve OpenAPI 3.1.0 strategy given OpenAPI 3.1.0 definition via spec option and referenced schema contains allOf keyword should contain schema with merged properties from allOf 1`] = `
3105-
{
3106-
"errors": [],
3107-
"spec": {
3108-
"$$normalized": true,
3109-
"components": {
3110-
"schemas": {
3111-
"Foo": {
3112-
"properties": {
3113-
"bar": {
3114-
"properties": {
3115-
"a": {
3116-
"type": "integer",
3117-
},
3118-
},
3119-
"type": "object",
3120-
},
3121-
},
3122-
"type": "object",
3123-
},
3124-
},
3125-
},
3126-
"info": {
3127-
"title": "Example generation test",
3128-
"version": "1.0.0",
3129-
},
3130-
"openapi": "3.1.0",
3131-
"paths": {
3132-
"/foo": {
3133-
"get": {
3134-
"responses": {
3135-
"200": {
3136-
"content": {
3137-
"application/json": {
3138-
"schema": {
3139-
"properties": {
3140-
"bar": {
3141-
"properties": {
3142-
"a": {
3143-
"type": "integer",
3144-
},
3145-
},
3146-
"type": "object",
3147-
},
3148-
},
3149-
"type": "object",
3150-
},
3151-
},
3152-
},
3153-
},
3154-
},
3155-
"servers": [
3156-
{
3157-
"url": "/",
3158-
},
3159-
],
3160-
},
3161-
"servers": [
3162-
{
3163-
"url": "/",
3164-
},
3165-
],
3166-
},
3167-
},
3168-
"servers": [
3169-
{
3170-
"url": "/",
3171-
},
3172-
],
3173-
},
3174-
}
3175-
`;
3176-
31773104
exports[`resolve OpenAPI 3.1.0 strategy given OpenAPI 3.1.0 definition via spec option and skipNormalization=false should resolve and normalize 1`] = `
31783105
{
31793106
"errors": [],

test/resolver/strategies/openapi-3-1-apidom/index.js

-11
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,6 @@ describe('resolve', () => {
291291
});
292292
});
293293
});
294-
295-
describe('and referenced schema contains allOf keyword', () => {
296-
test('should contain schema with merged properties from allOf', async () => {
297-
const spec = globalThis.loadJsonFile(path.join(fixturePath, 'ref-all-of.json'));
298-
const resolvedSpec = await SwaggerClient.resolve({
299-
spec,
300-
});
301-
302-
expect(resolvedSpec).toMatchSnapshot();
303-
});
304-
});
305294
});
306295
});
307296
});

0 commit comments

Comments
 (0)