Skip to content

Commit

Permalink
Add Unit test FBSDKApplicationDelegate
Browse files Browse the repository at this point in the history
Summary: Unit test checks if FBSDKAppEvents becomes active

Reviewed By: tianqibt

Differential Revision: D15379668

fbshipit-source-id: f9e41506a9e449ef544d487ac2c95d71d6da5ed9
  • Loading branch information
Steven Gschwind authored and facebook-github-bot committed May 20, 2019
1 parent 8de91df commit 11947ad
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions FBSDKCoreKit/FBSDKCoreKitTests/FBSDKApplicationDelegateTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ @interface FBSDKApplicationDelegateTests : XCTestCase {
@interface FBSDKApplicationDelegate(Test)

- (void)_logSDKInitialize;
- (void)applicationDidBecomeActive:(NSNotification *)notification;

@end

Expand Down Expand Up @@ -85,4 +86,26 @@ - (void)testAutoLogAppEventsDisabled {
[_delegate application:app didFinishLaunchingWithOptions:nil];
}

- (void)testAppEventsEnabled {

[OCMStub(ClassMethod([_settingsMock isAutoLogAppEventsEnabled])) andReturnValue: OCMOCK_VALUE(YES)];

id appEvents = OCMClassMock([FBSDKAppEvents class]);

id notification = OCMClassMock([NSNotification class]);
[_delegate applicationDidBecomeActive:notification];

OCMVerify([appEvents activateApp]);
}

-(void)testAppEventsDisabled {

[OCMStub(ClassMethod([_settingsMock isAutoLogAppEventsEnabled])) andReturnValue: OCMOCK_VALUE(NO)];

id appEvents = OCMStrictClassMock([FBSDKAppEvents class]);
OCMReject([appEvents activateApp]);

id notification = OCMClassMock([NSNotification class]);
[_delegate applicationDidBecomeActive:notification];
}
@end

0 comments on commit 11947ad

Please sign in to comment.