|
@@ -26,8 +26,7 @@
|
26
|
26
|
|
27
|
27
|
@interface RNNCommandsHandlerTest : XCTestCase
|
28
|
28
|
|
29
|
|
-@property (nonatomic, strong) RNNStore* store;
|
30
|
|
-@property (nonatomic, strong) id overlayStore;
|
|
29
|
+@property (nonatomic, strong) id store;
|
31
|
30
|
@property (nonatomic, strong) RNNCommandsHandler* uut;
|
32
|
31
|
@property (nonatomic, strong) RNNRootViewController* vc1;
|
33
|
32
|
@property (nonatomic, strong) RNNRootViewController* vc2;
|
|
@@ -43,13 +42,11 @@
|
43
|
42
|
|
44
|
43
|
- (void)setUp {
|
45
|
44
|
[super setUp];
|
46
|
|
-// [self.store setReadyToReceiveCommands:true];
|
47
|
|
- self.store = [[RNNStore alloc] init];
|
48
|
|
- self.overlayStore = [OCMockObject partialMockForObject:[[RNNStore alloc] init]];
|
|
45
|
+ self.store = [OCMockObject partialMockForObject:[[RNNStore alloc] init]];
|
49
|
46
|
self.eventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
|
50
|
47
|
self.overlayManager = [OCMockObject partialMockForObject:[RNNOverlayManager new]];
|
51
|
48
|
self.controllerFactory = [OCMockObject partialMockForObject:[[RNNControllerFactory alloc] initWithRootViewCreator:nil eventEmitter:self.eventEmmiter andBridge:nil]];
|
52
|
|
- self.uut = [[RNNCommandsHandler alloc] initWithStore:self.store overlayStore:self.overlayStore controllerFactory:self.controllerFactory eventEmitter:self.eventEmmiter stackManager:[RNNNavigationStackManager new] modalManager:[RNNModalManager new] overlayManager:self.overlayManager];
|
|
49
|
+ self.uut = [[RNNCommandsHandler alloc] initWithStore:self.store controllerFactory:self.controllerFactory eventEmitter:self.eventEmmiter stackManager:[RNNNavigationStackManager new] modalManager:[RNNModalManager new] overlayManager:self.overlayManager];
|
53
|
50
|
self.vc1 = [RNNRootViewController new];
|
54
|
51
|
self.vc2 = [RNNRootViewController new];
|
55
|
52
|
self.vc3 = [RNNRootViewController new];
|
|
@@ -76,7 +73,7 @@
|
76
|
73
|
-(NSArray*) getPublicMethodNamesForObject:(NSObject*)obj{
|
77
|
74
|
NSMutableArray* skipMethods = [NSMutableArray new];
|
78
|
75
|
|
79
|
|
- [skipMethods addObject:@"initWithStore:overlayStore:controllerFactory:eventEmitter:stackManager:modalManager:overlayManager:"];
|
|
76
|
+ [skipMethods addObject:@"initWithStore:controllerFactory:eventEmitter:stackManager:modalManager:overlayManager:"];
|
80
|
77
|
[skipMethods addObject:@"assertReady"];
|
81
|
78
|
[skipMethods addObject:@"removePopedViewControllers:"];
|
82
|
79
|
[skipMethods addObject:@".cxx_destruct"];
|
|
@@ -198,17 +195,17 @@
|
198
|
195
|
OCMStub([self.overlayManager showOverlay:[OCMArg any]]);
|
199
|
196
|
NSDictionary* layout = @{};
|
200
|
197
|
|
201
|
|
- [[self.controllerFactory expect] createLayout:layout saveToStore:self.overlayStore];
|
|
198
|
+ [[self.controllerFactory expect] createLayout:layout saveToStore:self.store];
|
202
|
199
|
[self.uut showOverlay:layout completion:^{}];
|
203
|
200
|
[self.controllerFactory verify];
|
204
|
201
|
}
|
205
|
202
|
|
206
|
|
-- (void)testShowOverlay_saveToOverlayStore {
|
|
203
|
+- (void)testShowOverlay_saveToStore {
|
207
|
204
|
[self.store setReadyToReceiveCommands:true];
|
208
|
205
|
OCMStub([self.overlayManager showOverlay:[OCMArg any]]);
|
209
|
206
|
OCMStub([self.controllerFactory createLayout:[OCMArg any] saveToStore:[OCMArg any]]);
|
210
|
207
|
|
211
|
|
- [[self.controllerFactory expect] createLayout:[OCMArg any] saveToStore:self.overlayStore];
|
|
208
|
+ [[self.controllerFactory expect] createLayout:[OCMArg any] saveToStore:self.store];
|
212
|
209
|
[self.uut showOverlay:@{} completion:^{}];
|
213
|
210
|
[self.overlayManager verify];
|
214
|
211
|
}
|
|
@@ -235,19 +232,19 @@
|
235
|
232
|
[self.eventEmmiter verify];
|
236
|
233
|
}
|
237
|
234
|
|
238
|
|
-- (void)testDismissOverlay_findComponentFromOverlayStore {
|
|
235
|
+- (void)testDismissOverlay_findComponentFromStore {
|
239
|
236
|
[self.store setReadyToReceiveCommands:true];
|
240
|
237
|
NSString* componentId = @"componentId";
|
241
|
|
- [[self.overlayStore expect] findComponentForId:componentId];
|
|
238
|
+ [[self.store expect] findComponentForId:componentId];
|
242
|
239
|
[self.uut dismissOverlay:componentId completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
|
243
|
|
- [self.overlayStore verify];
|
|
240
|
+ [self.store verify];
|
244
|
241
|
}
|
245
|
242
|
|
246
|
243
|
- (void)testDismissOverlay_dismissReturnedViewController {
|
247
|
244
|
[self.store setReadyToReceiveCommands:true];
|
248
|
245
|
NSString* componentId = @"componentId";
|
249
|
246
|
UIViewController* returnedView = [UIViewController new];
|
250
|
|
- OCMStub([self.overlayStore findComponentForId:componentId]).andReturn(returnedView);
|
|
247
|
+ OCMStub([self.store findComponentForId:componentId]).andReturn(returnedView);
|
251
|
248
|
|
252
|
249
|
[[self.overlayManager expect] dismissOverlay:returnedView];
|
253
|
250
|
[self.uut dismissOverlay:componentId completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
|
|
@@ -267,7 +264,7 @@
|
267
|
264
|
- (void)testDismissOverlay_invokeNavigationCommandEvent {
|
268
|
265
|
[self.store setReadyToReceiveCommands:true];
|
269
|
266
|
NSString* componentId = @"componentId";
|
270
|
|
- OCMStub([self.overlayStore findComponentForId:componentId]).andReturn([UIViewController new]);
|
|
267
|
+ OCMStub([self.store findComponentForId:componentId]).andReturn([UIViewController new]);
|
271
|
268
|
|
272
|
269
|
[[self.eventEmmiter expect] sendOnNavigationCommandCompletion:@"dismissOverlay" params:[OCMArg any]];
|
273
|
270
|
[self.uut dismissOverlay:componentId completion:^{
|