@@ -79,6 +79,7 @@ final class DocumentTests: XCTestCase {
79
79
}
80
80
81
81
func test_getAllOperationIds( ) {
82
+ // paths, no operation ids, no components, no webhooks
82
83
let t1 = OpenAPI . Document (
83
84
info: . init( title: " test " , version: " 1.0 " ) ,
84
85
servers: [ ] ,
@@ -93,6 +94,7 @@ final class DocumentTests: XCTestCase {
93
94
94
95
XCTAssertEqual ( t1. allOperationIds, [ ] )
95
96
97
+ // paths, one operation id (second one nil), no components, no webhooks
96
98
let t2 = OpenAPI . Document (
97
99
info: . init( title: " test " , version: " 1.0 " ) ,
98
100
servers: [ ] ,
@@ -107,6 +109,7 @@ final class DocumentTests: XCTestCase {
107
109
108
110
XCTAssertEqual ( t2. allOperationIds, [ " test " ] )
109
111
112
+ // paths, multiple operation ids, no components, no webhooks
110
113
let t3 = OpenAPI . Document (
111
114
info: . init( title: " test " , version: " 1.0 " ) ,
112
115
servers: [ ] ,
@@ -121,6 +124,7 @@ final class DocumentTests: XCTestCase {
121
124
122
125
XCTAssertEqual ( t3. allOperationIds, [ " test " , " two " ] )
123
126
127
+ // paths, one operation id (first one nil), no components, no webhooks
124
128
let t4 = OpenAPI . Document (
125
129
info: . init( title: " test " , version: " 1.0 " ) ,
126
130
servers: [ ] ,
@@ -134,6 +138,36 @@ final class DocumentTests: XCTestCase {
134
138
)
135
139
136
140
XCTAssertEqual ( t4. allOperationIds, [ " two " ] )
141
+
142
+ // paths, one operation id, one component reference, no webhooks
143
+ let t5 = OpenAPI . Document (
144
+ info: . init( title: " test " , version: " 1.0 " ) ,
145
+ servers: [ ] ,
146
+ paths: [
147
+ " /hello " : . init(
148
+ get: . init( operationId: " test " , responses: [ : ] ) ) ,
149
+ " /hello/world " : . reference( . component( named: " hello-world " ) )
150
+ ] ,
151
+ components: . init(
152
+ pathItems: [ " hello-world " : . init( put: . init( operationId: " two " , responses: [ : ] ) ) ]
153
+ )
154
+ )
155
+
156
+ XCTAssertEqual ( t5. allOperationIds, [ " test " , " two " ] )
157
+
158
+ // no paths, one webhook with an operation id
159
+ let t6 = OpenAPI . Document (
160
+ info: . init( title: " test " , version: " 1.0 " ) ,
161
+ servers: [ ] ,
162
+ paths: [ : ] ,
163
+ webhooks: [
164
+ " /hello " : . init(
165
+ get: . init( operationId: " test " , responses: [ : ] ) )
166
+ ] ,
167
+ components: . noComponents
168
+ )
169
+
170
+ XCTAssertEqual ( t6. allOperationIds, [ " test " ] )
137
171
}
138
172
139
173
func test_allServersEmpty( ) {
0 commit comments