@@ -119,6 +119,19 @@ final class PrimitiveSequenceTypeTests: XCTestCase {
119
119
) . toEventually ( be ( 1 ) )
120
120
}
121
121
122
+ func test_promises_completable_action_dispatch_fill_on_error( ) {
123
+ Single
124
+ . error ( Error . dummy)
125
+ . dispatch ( action: PromisesTestCompletableAction . self, on: dispatcher, fillOnError: 1 )
126
+ . disposed ( by: disposeBag)
127
+
128
+ expect (
129
+ self . testMiddleware. actions ( of: PromisesTestCompletableAction . self) . count
130
+ ) . toEventually ( be ( 1 ) )
131
+
132
+ expect ( self . testMiddleware. actions ( of: PromisesTestCompletableAction . self) . first? . promise. value) == 1
133
+ }
134
+
122
135
func test_promises_completable_action_dispatch_error( ) {
123
136
Single
124
137
. error ( Error . dummy)
@@ -150,6 +163,20 @@ final class PrimitiveSequenceTypeTests: XCTestCase {
150
163
) . toEventually ( beTrue ( ) )
151
164
}
152
165
166
+ func test_promises_keyed_completable_action_dispatch_fill_on_error( ) {
167
+ Single
168
+ . error ( Error . dummy)
169
+ . dispatch ( action: PromisesTestKeyedCompletableAction . self, key: " hello " , on: dispatcher, fillOnError: 1 )
170
+ . disposed ( by: disposeBag)
171
+
172
+ expect (
173
+ self . testMiddleware
174
+ . action ( of: PromisesTestKeyedCompletableAction . self) {
175
+ $0. promise == [ " hello " : . value( 1 ) ]
176
+ }
177
+ ) . toEventually ( beTrue ( ) )
178
+ }
179
+
153
180
func test_promises_keyed_completable_action_dispatch_error( ) {
154
181
Single
155
182
. error ( Error . dummy)
@@ -174,6 +201,46 @@ final class PrimitiveSequenceTypeTests: XCTestCase {
174
201
expect ( action) . to ( equalAction ( PromisesTestCompletableAction ( promise: . value( 1 ) ) ) )
175
202
}
176
203
204
+ func test_promises_completable_action_action_fill_on_error( ) throws {
205
+ guard let action =
206
+ try Single
207
+ . error ( Error . dummy)
208
+ . action ( PromisesTestCompletableAction . self, fillOnError: 1 )
209
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
210
+
211
+ expect ( action) . to ( equalAction ( PromisesTestCompletableAction ( promise: . value( 1 ) ) ) )
212
+ }
213
+
214
+ func test_promises_completable_action_action_error( ) throws {
215
+ guard let action =
216
+ try Single
217
+ . error ( Error . dummy)
218
+ . action ( PromisesTestCompletableAction . self)
219
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
220
+
221
+ expect ( action) . to ( equalAction ( PromisesTestCompletableAction ( promise: . error( Error . dummy) ) ) )
222
+ }
223
+
224
+ func test_promises_empty_action_action( ) throws {
225
+ guard let action =
226
+ try Completable
227
+ . empty ( )
228
+ . action ( PromisesTestEmptyAction . self)
229
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
230
+
231
+ expect ( action) . to ( equalAction ( PromisesTestEmptyAction ( promise: . empty( ) ) ) )
232
+ }
233
+
234
+ func test_promises_empty_action_action_error( ) throws {
235
+ guard let action =
236
+ try Completable
237
+ . error ( Error . dummy)
238
+ . action ( PromisesTestEmptyAction . self)
239
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
240
+
241
+ expect ( action) . to ( equalAction ( PromisesTestEmptyAction ( promise: . error( Error . dummy) ) ) )
242
+ }
243
+
177
244
func test_promises_empty_action_dispatch( ) {
178
245
Completable
179
246
. empty ( )
@@ -217,6 +284,19 @@ final class PrimitiveSequenceTypeTests: XCTestCase {
217
284
) . toEventually ( be ( 1 ) )
218
285
}
219
286
287
+ func test_tasks_completable_action_dispatch_fill_on_error( ) {
288
+ Single
289
+ . error ( Error . dummy)
290
+ . dispatch ( action: TasksTestCompletableAction . self, on: dispatcher, fillOnError: 1 )
291
+ . disposed ( by: disposeBag)
292
+
293
+ expect (
294
+ self . testMiddleware. actions ( of: TasksTestCompletableAction . self) . count
295
+ ) . toEventually ( be ( 1 ) )
296
+
297
+ expect ( self . testMiddleware. actions ( of: TasksTestCompletableAction . self) . first? . payload) == 1
298
+ }
299
+
220
300
func test_tasks_completable_action_dispatch_error( ) {
221
301
Single
222
302
. error ( Error . dummy)
@@ -248,6 +328,20 @@ final class PrimitiveSequenceTypeTests: XCTestCase {
248
328
) . toEventually ( beTrue ( ) )
249
329
}
250
330
331
+ func test_tasks_keyed_completable_action_dispatch_fill_on_error( ) {
332
+ Single
333
+ . error ( Error . dummy)
334
+ . dispatch ( action: TasksTestKeyedCompletableAction . self, key: " hello " , on: dispatcher, fillOnError: 1 )
335
+ . disposed ( by: disposeBag)
336
+
337
+ expect (
338
+ self . testMiddleware
339
+ . action ( of: TasksTestKeyedCompletableAction . self) {
340
+ $0. payload == 1 && $0. key == " hello " && $0. task. status == . success
341
+ }
342
+ ) . toEventually ( beTrue ( ) )
343
+ }
344
+
251
345
func test_tasks_keyed_completable_action_dispatch_error( ) {
252
346
Single
253
347
. error ( Error . dummy)
@@ -272,6 +366,46 @@ final class PrimitiveSequenceTypeTests: XCTestCase {
272
366
expect ( action) . to ( equalAction ( TasksTestCompletableAction ( task: . success( ) , payload: 1 ) ) )
273
367
}
274
368
369
+ func test_tasks_completable_action_action_fill_on_error( ) throws {
370
+ guard let action =
371
+ try Single
372
+ . error ( Error . dummy)
373
+ . action ( TasksTestCompletableAction . self, fillOnError: 1 )
374
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
375
+
376
+ expect ( action) . to ( equalAction ( TasksTestCompletableAction ( task: . success( ) , payload: 1 ) ) )
377
+ }
378
+
379
+ func test_tasks_completable_action_action_error( ) throws {
380
+ guard let action =
381
+ try Single
382
+ . error ( Error . dummy)
383
+ . action ( TasksTestCompletableAction . self)
384
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
385
+
386
+ expect ( action) . to ( equalAction ( TasksTestCompletableAction ( task: . failure( Error . dummy) , payload: nil ) ) )
387
+ }
388
+
389
+ func test_tasks_empty_action_action( ) throws {
390
+ guard let action =
391
+ try Completable
392
+ . empty ( )
393
+ . action ( TasksTestEmptyAction . self)
394
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
395
+
396
+ expect ( action) . to ( equalAction ( TasksTestEmptyAction ( task: . success( ) ) ) )
397
+ }
398
+
399
+ func test_tasks_empty_action_action_error( ) throws {
400
+ guard let action =
401
+ try Completable
402
+ . error ( Error . dummy)
403
+ . action ( TasksTestEmptyAction . self)
404
+ . toBlocking ( timeout: 5.0 ) . first ( ) else { fatalError ( ) }
405
+
406
+ expect ( action) . to ( equalAction ( TasksTestEmptyAction ( task: . failure( Error . dummy) ) ) )
407
+ }
408
+
275
409
func test_tasks_empty_action_dispatch( ) {
276
410
Completable
277
411
. empty ( )
0 commit comments