-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathInstabugFeatureRequestsTests.m
68 lines (55 loc) · 2.17 KB
/
InstabugFeatureRequestsTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// InstabugFeatureRequestsTests.m
// InstabugSampleTests
//
// Created by Salma Ali on 7/31/19.
// Copyright © 2019 Facebook. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "InstabugFeatureRequestsBridge.h"
#import <Instabug/IBGTypes.h>
#import "Instabug/Instabug.h"
#import "IBGConstants.h"
@interface InstabugFeatureRequestsTests : XCTestCase
@property (nonatomic, retain) InstabugFeatureRequestsBridge *instabugBridge;
@end
@implementation InstabugFeatureRequestsTests
- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class.
self.instabugBridge = [[InstabugFeatureRequestsBridge alloc] init];
}
/*
+------------------------------------------------------------------------+
| Feature Requets Module |
+------------------------------------------------------------------------+
*/
- (void) testgivenArgs$setEmailFieldRequiredForFeatureRequests_whenQuery_thenShouldCallNativeApi {
id mock = OCMClassMock([IBGFeatureRequests class]);
BOOL required = true;
NSArray *actionTypesArray = [NSArray arrayWithObjects: @(IBGActionReportBug), nil];
IBGAction actionTypes = 0;
for (NSNumber *boxedValue in actionTypesArray) {
actionTypes |= [boxedValue intValue];
}
OCMStub([mock setEmailFieldRequired:required forAction:actionTypes]);
[self.instabugBridge setEmailFieldRequiredForFeatureRequests:required forAction:actionTypesArray];
OCMVerify([mock setEmailFieldRequired:required forAction:actionTypes]);
}
- (void) testgive$show_whenQuery_thenShouldCallNativeApi {
id mock = OCMClassMock([IBGFeatureRequests class]);
OCMStub([mock show]);
[self.instabugBridge show];
XCTestExpectation *expectation = [self expectationWithDescription:@"Test ME PLX"];
[[NSRunLoop mainRunLoop] performBlock:^{
OCMVerify([mock show]);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:EXPECTATION_TIMEOUT handler:nil];
}
- (void) testgivenBoolean$setEnabled_whenQuery_thenShouldCallNativeApi {
BOOL enabled = false;
[self.instabugBridge setEnabled:enabled];
XCTAssertFalse(IBGFeatureRequests.enabled);
}
@end