@@ -24,23 +24,15 @@ import {
24
24
OperationSecurityMetadataStorage ,
25
25
PropertyMetadataStorage ,
26
26
} from "../src/metadata/index.js" ;
27
- import {
28
- ApiBasicAuth ,
29
- ApiBearerAuth ,
30
- ApiCookieAuth ,
31
- ApiOauth2 ,
32
- } from "../src/decorators/api-security.js" ;
27
+ import { ApiBasicAuth , ApiBearerAuth , ApiCookieAuth , ApiOauth2 } from "../src/decorators/api-security.js" ;
33
28
34
29
test ( "@ApiOperation" , ( ) => {
35
30
class MyController {
36
31
@ApiOperation ( { summary : "Hello" , path : "/test" , methods : [ "get" ] } )
37
32
operation ( ) { }
38
33
}
39
34
40
- const metadata = OperationMetadataStorage . getMetadata (
41
- MyController . prototype ,
42
- "operation" ,
43
- ) ;
35
+ const metadata = OperationMetadataStorage . getMetadata ( MyController . prototype , "operation" ) ;
44
36
45
37
expect ( metadata ) . toEqual ( {
46
38
summary : "Hello" ,
@@ -55,10 +47,7 @@ test("@ApiBody", () => {
55
47
operation ( ) { }
56
48
}
57
49
58
- const metadata = OperationBodyMetadataStorage . getMetadata (
59
- MyController . prototype ,
60
- "operation" ,
61
- ) ;
50
+ const metadata = OperationBodyMetadataStorage . getMetadata ( MyController . prototype , "operation" ) ;
62
51
63
52
expect ( metadata ) . toEqual ( {
64
53
type : "string" ,
@@ -73,11 +62,7 @@ test("@ApiParam", () => {
73
62
operation ( ) { }
74
63
}
75
64
76
- const metadata = OperationParameterMetadataStorage . getMetadata (
77
- MyController . prototype ,
78
- "operation" ,
79
- true ,
80
- ) ;
65
+ const metadata = OperationParameterMetadataStorage . getMetadata ( MyController . prototype , "operation" , true ) ;
81
66
82
67
expect ( metadata ) . toEqual ( [
83
68
{ in : "path" , name : "test" } ,
@@ -92,11 +77,7 @@ test("@ApiHeader", () => {
92
77
operation ( ) { }
93
78
}
94
79
95
- const metadata = OperationParameterMetadataStorage . getMetadata (
96
- MyController . prototype ,
97
- "operation" ,
98
- true ,
99
- ) ;
80
+ const metadata = OperationParameterMetadataStorage . getMetadata ( MyController . prototype , "operation" , true ) ;
100
81
101
82
expect ( metadata ) . toEqual ( [
102
83
{ in : "header" , name : "test" } ,
@@ -111,11 +92,7 @@ test("@ApiCookie", () => {
111
92
operation ( ) { }
112
93
}
113
94
114
- const metadata = OperationParameterMetadataStorage . getMetadata (
115
- MyController . prototype ,
116
- "operation" ,
117
- true ,
118
- ) ;
95
+ const metadata = OperationParameterMetadataStorage . getMetadata ( MyController . prototype , "operation" , true ) ;
119
96
120
97
expect ( metadata ) . toEqual ( [
121
98
{ in : "cookie" , name : "test" } ,
@@ -130,11 +107,7 @@ test("@ApiQuery", () => {
130
107
operation ( ) { }
131
108
}
132
109
133
- const metadata = OperationParameterMetadataStorage . getMetadata (
134
- MyController . prototype ,
135
- "operation" ,
136
- true ,
137
- ) ;
110
+ const metadata = OperationParameterMetadataStorage . getMetadata ( MyController . prototype , "operation" , true ) ;
138
111
139
112
expect ( metadata ) . toEqual ( [
140
113
{ in : "query" , name : "test" } ,
@@ -149,11 +122,7 @@ test("@ApiResponse", () => {
149
122
operation ( ) { }
150
123
}
151
124
152
- const metadata = OperationResponseMetadataStorage . getMetadata (
153
- MyController . prototype ,
154
- "operation" ,
155
- true ,
156
- ) ;
125
+ const metadata = OperationResponseMetadataStorage . getMetadata ( MyController . prototype , "operation" , true ) ;
157
126
158
127
expect ( metadata ) . toEqual ( {
159
128
default : { status : "default" , mediaType : "text/html" , type : "string" } ,
@@ -168,11 +137,7 @@ test("@ApiTags", () => {
168
137
operation ( ) { }
169
138
}
170
139
171
- const metadata = OperationMetadataStorage . getMetadata (
172
- MyController . prototype ,
173
- "operation" ,
174
- true ,
175
- ) ;
140
+ const metadata = OperationMetadataStorage . getMetadata ( MyController . prototype , "operation" , true ) ;
176
141
177
142
expect ( metadata . tags ) . toEqual ( [ "Root" , "Hello" , "World" ] ) ;
178
143
} ) ;
@@ -187,11 +152,7 @@ test("@ApiSecurity", () => {
187
152
operation ( ) { }
188
153
}
189
154
190
- const metadata = OperationSecurityMetadataStorage . getMetadata (
191
- MyController . prototype ,
192
- "operation" ,
193
- true ,
194
- ) ;
155
+ const metadata = OperationSecurityMetadataStorage . getMetadata ( MyController . prototype , "operation" , true ) ;
195
156
196
157
expect ( metadata ) . toEqual ( {
197
158
custom : [ ] ,
@@ -216,10 +177,7 @@ test("@ApiExcludeOperation", () => {
216
177
operation ( ) { }
217
178
}
218
179
219
- const metadata = ExcludeMetadataStorage . getMetadata (
220
- MyController . prototype ,
221
- "operation" ,
222
- ) ;
180
+ const metadata = ExcludeMetadataStorage . getMetadata ( MyController . prototype , "operation" ) ;
223
181
expect ( metadata ) . toBe ( true ) ;
224
182
} ) ;
225
183
0 commit comments