@@ -91,6 +91,8 @@ class LambdaHandlerTest: XCTestCase {
91
91
struct Handler : AsyncLambdaHandler {
92
92
typealias In = String
93
93
typealias Out = String
94
+
95
+ init ( context: Lambda . InitializationContext ) { }
94
96
95
97
func handle( event: String , context: Lambda . Context ) async throws -> String {
96
98
event
@@ -99,7 +101,7 @@ class LambdaHandlerTest: XCTestCase {
99
101
100
102
let maxTimes = Int . random ( in: 1 ... 10 )
101
103
let configuration = Lambda . Configuration ( lifecycle: . init( maxTimes: maxTimes) )
102
- let result = Lambda . run ( configuration: configuration, handler : Handler ( ) )
104
+ let result = Lambda . run ( configuration: configuration, factory : Handler . init )
103
105
assertLambdaLifecycleResult ( result, shoudHaveRun: maxTimes)
104
106
}
105
107
@@ -111,13 +113,15 @@ class LambdaHandlerTest: XCTestCase {
111
113
struct Handler : AsyncLambdaHandler {
112
114
typealias In = String
113
115
typealias Out = Void
116
+
117
+ init ( context: Lambda . InitializationContext ) { }
114
118
115
119
func handle( event: String , context: Lambda . Context ) async throws { }
116
120
}
117
121
118
122
let maxTimes = Int . random ( in: 1 ... 10 )
119
123
let configuration = Lambda . Configuration ( lifecycle: . init( maxTimes: maxTimes) )
120
- let result = Lambda . run ( configuration: configuration, handler : Handler ( ) )
124
+ let result = Lambda . run ( configuration: configuration, factory : Handler . init )
121
125
assertLambdaLifecycleResult ( result, shoudHaveRun: maxTimes)
122
126
}
123
127
@@ -129,6 +133,8 @@ class LambdaHandlerTest: XCTestCase {
129
133
struct Handler : AsyncLambdaHandler {
130
134
typealias In = String
131
135
typealias Out = String
136
+
137
+ init ( context: Lambda . InitializationContext ) { }
132
138
133
139
func handle( event: String , context: Lambda . Context ) async throws -> String {
134
140
throw TestError ( " boom " )
@@ -137,7 +143,7 @@ class LambdaHandlerTest: XCTestCase {
137
143
138
144
let maxTimes = Int . random ( in: 1 ... 10 )
139
145
let configuration = Lambda . Configuration ( lifecycle: . init( maxTimes: maxTimes) )
140
- let result = Lambda . run ( configuration: configuration, handler : Handler ( ) )
146
+ let result = Lambda . run ( configuration: configuration, factory : Handler . init )
141
147
assertLambdaLifecycleResult ( result, shoudHaveRun: maxTimes)
142
148
}
143
149
#endif
0 commit comments