Skip to content

Commit 591e922

Browse files
committed
test: 添加文件头并更新测试配置
- 在 pet-store.ts 文件中添加生成文件头信息 - 在多个测试文件中添加 hideAlert 配置项 - 更新路径、参数、请求、响应等测试用例,增加 hideAlert 配置
1 parent e754eeb commit 591e922

15 files changed

+77
-0
lines changed

test/example-dest/2.0/pet-store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/**
2+
* This file is generated by pkg-name-for-test@pkg-version-for-test.
3+
* Please do not edit it manually.
4+
* If you use the following tools, you can refer to the corresponding documentation
5+
* and ignore the check of this file.
6+
* - [ESLint](https://eslint.org/docs/latest/use/configure/ignore)
7+
* - [Prettier](https://prettier.io/docs/en/ignore.html)
8+
* - [Biome](https://biomejs.dev/guides/configure-biome/#ignore-files)
9+
*/
10+
111
/**
212
* @title Swagger Petstore
313
* @version 1.0.0

test/example-dest/3.0/pet-store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/**
2+
* This file is generated by pkg-name-for-test@pkg-version-for-test.
3+
* Please do not edit it manually.
4+
* If you use the following tools, you can refer to the corresponding documentation
5+
* and ignore the check of this file.
6+
* - [ESLint](https://eslint.org/docs/latest/use/configure/ignore)
7+
* - [Prettier](https://prettier.io/docs/en/ignore.html)
8+
* - [Biome](https://biomejs.dev/guides/configure-biome/#ignore-files)
9+
*/
10+
111
/**
212
* @title Swagger Petstore - OpenAPI 3.0
313
* @version 1.0.19

test/example-dest/3.1/pet-store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/**
2+
* This file is generated by pkg-name-for-test@pkg-version-for-test.
3+
* Please do not edit it manually.
4+
* If you use the following tools, you can refer to the corresponding documentation
5+
* and ignore the check of this file.
6+
* - [ESLint](https://eslint.org/docs/latest/use/configure/ignore)
7+
* - [Prettier](https://prettier.io/docs/en/ignore.html)
8+
* - [Biome](https://biomejs.dev/guides/configure-biome/#ignore-files)
9+
*/
10+
111
/**
212
* @title Swagger Petstore - OpenAPI 3.1
313
* @version 1.0.7

test/printer/arg.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ it('1*path + 1*query + 1*header', () => {
5454
hideHeaders: true,
5555
hideFooters: true,
5656
hideInfo: true,
57+
hideAlert: true,
5758
hideHelpers: true,
5859
}),
5960
).toMatchInlineSnapshot(`
@@ -138,6 +139,7 @@ it('n*path + 1*query + 1*header', () => {
138139
hideHeaders: true,
139140
hideFooters: true,
140141
hideInfo: true,
142+
hideAlert: true,
141143
hideHelpers: true,
142144
}),
143145
).toMatchInlineSnapshot(`
@@ -232,6 +234,7 @@ it('n*path + n*query + 1*header', () => {
232234
hideHeaders: true,
233235
hideFooters: true,
234236
hideInfo: true,
237+
hideAlert: true,
235238
hideHelpers: true,
236239
}),
237240
).toMatchInlineSnapshot(`
@@ -336,6 +339,7 @@ it('n*path + n*query + n*header', () => {
336339
hideHeaders: true,
337340
hideFooters: true,
338341
hideInfo: true,
342+
hideAlert: true,
339343
hideHelpers: true,
340344
}),
341345
).toMatchInlineSnapshot(`
@@ -399,6 +403,7 @@ it('path name unique', () => {
399403
hideHeaders: true,
400404
hideFooters: true,
401405
hideInfo: true,
406+
hideAlert: true,
402407
hideHelpers: true,
403408
}),
404409
).toMatchInlineSnapshot(`

test/printer/options.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ it('axios 模块导入名称默认', () => {
1616
});
1717
expect(printer.print({
1818
hideInfo: true,
19+
hideAlert: true,
1920
hideHelpers: true,
2021
})).toMatchInlineSnapshot(`
2122
"import axios from "axios";
@@ -53,6 +54,7 @@ it('axios 模块导入名称指定', () => {
5354
});
5455
expect(printer.print({
5556
hideInfo: true,
57+
hideAlert: true,
5658
hideHelpers: true,
5759
})).toMatchInlineSnapshot(`
5860
"import {axios2 as axios} from "axios";
@@ -90,6 +92,7 @@ it('axios 默认导入名称为空', () => {
9092
});
9193
expect(printer.print({
9294
hideInfo: true,
95+
hideAlert: true,
9396
hideHelpers: true,
9497
})).toMatchInlineSnapshot(`
9598
"import axios from "axios";
@@ -132,6 +135,7 @@ it('axios 模块和类型指定文件', () => {
132135
expect(printer.print({
133136
file: '/a/d/my-api.ts',
134137
hideInfo: true,
138+
hideAlert: true,
135139
hideHelpers: true,
136140
})).toMatchInlineSnapshot(`
137141
"import {axios2 as axios} from "../b/request.ts";

test/printer/path.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ it('1路径 + 1请求', () => {
1919
hideHeaders: true,
2020
hideHelpers: true,
2121
hideInfo: true,
22+
hideAlert: true,
2223
hideImports: true,
2324
}),
2425
).toMatchInlineSnapshot(`
@@ -54,6 +55,7 @@ it('1路径 + 1请求 * module', () => {
5455
module: 'TTT',
5556
hideImports: true,
5657
hideHelpers: true,
58+
hideAlert: true,
5759
}),
5860
).toMatchInlineSnapshot(`
5961
"/**
@@ -96,6 +98,7 @@ it('1路径 + 2请求', () => {
9698
hideHeaders: true,
9799
hideHelpers: true,
98100
hideInfo: true,
101+
hideAlert: true,
99102
hideImports: true,
100103
}),
101104
).toMatchInlineSnapshot(`
@@ -159,6 +162,7 @@ it('1路径 + 1请求 + 1query', () => {
159162
hideHeaders: true,
160163
hideHelpers: true,
161164
hideInfo: true,
165+
hideAlert: true,
162166
hideImports: true,
163167
}),
164168
).toMatchInlineSnapshot(`
@@ -216,6 +220,7 @@ it('1路径 + 1请求 + 1query with duplicate', () => {
216220
hideHeaders: true,
217221
hideHelpers: true,
218222
hideInfo: true,
223+
hideAlert: true,
219224
hideImports: true,
220225
}),
221226
).toMatchInlineSnapshot(`
@@ -269,6 +274,7 @@ it('1路径 + 1请求 + 1path', () => {
269274
hideHeaders: true,
270275
hideHelpers: true,
271276
hideInfo: true,
277+
hideAlert: true,
272278
hideImports: true,
273279
}),
274280
).toMatchInlineSnapshot(`
@@ -328,6 +334,7 @@ it('1路径 + 1请求 + 2path', () => {
328334
hideHeaders: true,
329335
hideHelpers: true,
330336
hideInfo: true,
337+
hideAlert: true,
331338
hideImports: true,
332339
}),
333340
).toMatchInlineSnapshot(`
@@ -396,6 +403,7 @@ it('1路径 + 1请求 + 2query', () => {
396403
hideHeaders: true,
397404
hideHelpers: true,
398405
hideInfo: true,
406+
hideAlert: true,
399407
hideImports: true,
400408
}),
401409
).toMatchInlineSnapshot(`
@@ -478,6 +486,7 @@ it('1路径 + 1请求 + 2query + 1path', () => {
478486
hideHeaders: true,
479487
hideHelpers: true,
480488
hideInfo: true,
489+
hideAlert: true,
481490
hideImports: true,
482491
}),
483492
).toMatchInlineSnapshot(`
@@ -574,6 +583,7 @@ it('1路径 + 1请求 + 2query + 1path + 1request primitive', () => {
574583
hideHeaders: true,
575584
hideHelpers: true,
576585
hideInfo: true,
586+
hideAlert: true,
577587
hideImports: true,
578588
}),
579589
).toMatchInlineSnapshot(`
@@ -681,6 +691,7 @@ it('1路径 + 1请求 + 2query + 1path + 1request object', () => {
681691
hideHeaders: true,
682692
hideHelpers: true,
683693
hideInfo: true,
694+
hideAlert: true,
684695
hideImports: true,
685696
}),
686697
).toMatchInlineSnapshot(`
@@ -794,6 +805,7 @@ it('1路径 + 1请求 + 2query + 1path + 1request object + 1response primitive',
794805
hideHeaders: true,
795806
hideHelpers: true,
796807
hideInfo: true,
808+
hideAlert: true,
797809
hideImports: true,
798810
}),
799811
).toMatchInlineSnapshot(`
@@ -925,6 +937,7 @@ it('1路径 + 1请求 + 2query + 1path + 1request object + 1response object', ()
925937
hideHeaders: true,
926938
hideHelpers: true,
927939
hideInfo: true,
940+
hideAlert: true,
928941
hideImports: true,
929942
}),
930943
).toMatchInlineSnapshot(`

test/printer/ref-parameter.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ it('ref parameter', () => {
4141
hideHeaders: true,
4242
hideHelpers: true,
4343
hideInfo: true,
44+
hideAlert: true,
4445
hideImports: true,
4546
}),
4647
).toMatchInlineSnapshot(`

test/printer/ref-path.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ it('ref path', () => {
3131
hideHeaders: true,
3232
hideHelpers: true,
3333
hideInfo: true,
34+
hideAlert: true,
3435
hideImports: true,
3536
}),
3637
).toMatchInlineSnapshot(`

test/printer/ref-request.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ it('ref request', () => {
5656
hideHeaders: true,
5757
hideHelpers: true,
5858
hideInfo: true,
59+
hideAlert: true,
5960
hideImports: true,
6061
}),
6162
).toMatchInlineSnapshot(`

test/printer/ref-response.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ it('ref response', () => {
5858
hideHeaders: true,
5959
hideHelpers: true,
6060
hideInfo: true,
61+
hideAlert: true,
6162
hideImports: true,
6263
}),
6364
).toMatchInlineSnapshot(`

0 commit comments

Comments
 (0)