Skip to content

Commit 3e24d72

Browse files
test: decouple test case from typescript version
The externalModuleApiSpec tests are currently using the installed TypeScript version as the api spec version. This means when we bump the TypeScript version, we break tests. This commit specifies a literal version number instead of pulling the version number from TypeScript, so tests don't break when we update the TypeScript version.
1 parent 68ead3b commit 3e24d72

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

packages/openapi-generator/test/externalModuleApiSpec.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import assert from 'assert';
22
import test from 'node:test';
3-
import { version } from 'typescript';
43
import {
54
Project,
65
Route,
@@ -118,7 +117,7 @@ async function testCase(
118117
const openapi = convertRoutesToOpenAPI(
119118
{
120119
title: name,
121-
version,
120+
version: "1.0.0",
122121
description,
123122
},
124123
[],
@@ -138,7 +137,7 @@ testCase(
138137
openapi: '3.0.3',
139138
info: {
140139
title: 'simple api spec with imported types',
141-
version: '4.7.4',
140+
version: '1.0.0',
142141
description: 'simple api spec with imported types',
143142
},
144143
paths: {
@@ -237,7 +236,7 @@ testCase(
237236
openapi: '3.0.3',
238237
info: {
239238
title: 'simple api spec with exported enum',
240-
version: '4.7.4',
239+
version: '1.0.0',
241240
description: 'simple api spec with exported enum',
242241
},
243242
paths: {
@@ -279,7 +278,7 @@ testCase(
279278
openapi: "3.0.3",
280279
info: {
281280
title: "simple api spec with exported union type",
282-
version: "4.7.4",
281+
version: "1.0.0",
283282
description: "simple api spec with exported union type"
284283
},
285284
paths: {
@@ -324,7 +323,7 @@ testCase("simple api spec with custom codec", "test/sample-types/apiSpecWithCust
324323
openapi: "3.0.3",
325324
info: {
326325
title: "simple api spec with custom codec",
327-
version: "4.7.4",
326+
version: "1.0.0",
328327
description: "simple api spec with custom codec"
329328
},
330329
paths: {
@@ -363,4 +362,4 @@ testCase("simple api spec with custom codec", "test/sample-types/apiSpecWithCust
363362
components: {
364363
schemas: {}
365364
}
366-
}, []);
365+
}, []);

0 commit comments

Comments
 (0)