Skip to content

Commit db4d1ed

Browse files
committed
test(specmap): improve the complex schema tests
1 parent 4aeb682 commit db4d1ed

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

test/specmap/complex.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,28 @@ describe('complex', () => {
5151
});
5252
});
5353

54-
test('should resolve complex specs with allOf and nested references', async () => {
54+
test('should partially resolve complex specs with allOf and nested references', async () => {
5555
// Given
5656
const spec = globalThis.loadJsonFile(
57-
path.join(__dirname, 'data', 'specs', 'complex-example.json')
57+
path.join(__dirname, 'data', 'complex', 'complex-example.json')
5858
);
5959

6060
// When
6161
const result = await Swagger.resolve({ spec });
6262

6363
// Then
64-
expect(result).not.toEqual(null);
64+
expect(
65+
result.spec.components.schemas[
66+
'com.sap.ctsm.backend.core.api.study.v1.StudyAPIv1.StudyTreatments-create'
67+
].properties.scenario.allOf[0].$ref
68+
).toEqual(
69+
'#/components/schemas/com.sap.ctsm.backend.core.api.study.v1.StudyAPIv1.Scenarios-create'
70+
);
71+
72+
expect(
73+
result.spec.components.schemas[
74+
'com.sap.ctsm.backend.core.api.study.v1.StudyAPIv1.BlindingGroups'
75+
].properties.study.properties.scenarios.items.$$ref
76+
).toEqual('#/components/schemas/com.sap.ctsm.backend.core.api.study.v1.StudyAPIv1.Scenarios');
6577
});
6678
});

0 commit comments

Comments
 (0)