Skip to content

Commit ef152a9

Browse files
committed
test: update assertions for expanded URIs in full model and mocha v11
- Remove @context assertions for full model (expanded URIs don't carry @context) - Fix gRPC WebAPI type check to match both compact and expanded URI forms - Upgrade mocha to ^11.7.5 Made-with: Cursor
1 parent 3e37b25 commit ef152a9

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

test/api-generation.test.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ describe('API generation', () => {
195195
.then((exists) => assert.isTrue(exists))
196196
.then(() => fs.readJson(flattenedModelFile))
197197
.then((data) => {
198-
const graph = data['@graph'];
199-
assert.isDefined(graph);
200-
const ctx = data['@context'];
201-
assert.isDefined(ctx, '@context should exist in AMF v5');
198+
assertValidAmfModel(data);
202199
}));
203200

204201
it('Generates flattened data model for compact model', () => generator(configFile)
@@ -229,8 +226,6 @@ describe('API generation', () => {
229226
.then(() => fs.readJson(modelFile))
230227
.then((data) => {
231228
assertValidAmfModel(data);
232-
const ctx = data['@context'];
233-
assert.isDefined(ctx, '@context should exist in AMF v5');
234229
}));
235230

236231
it('Generates data model for compact model', () => generator(configFile, {
@@ -324,9 +319,9 @@ describe('API generation', () => {
324319
assert.isTrue(exists, 'model file exists');
325320
const data = await fs.readJson(modelFile);
326321
assertValidAmfModel(data);
327-
// Verify it's a gRPC/WebAPI model
322+
// Verify it's a gRPC/WebAPI model (type may be compact or full URI)
328323
const graph = data['@graph'];
329-
const webApi = graph.find(node => node['@type'] && node['@type'].includes('apiContract:WebAPI'));
324+
const webApi = graph.find(node => node['@type'] && node['@type'].some(t => t.includes('WebAPI')));
330325
assert.isDefined(webApi, 'Should contain WebAPI node');
331326
});
332327
});

0 commit comments

Comments
 (0)