Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
Summary: As title

Reviewed By: dreamolight

Differential Revision: D23956881

fbshipit-source-id: f2150cb5bb15ed96f07324f4a83f548369365081
  • Loading branch information
KylinChang committed Sep 28, 2020
1 parent c8c628b commit 3d02460
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,30 @@ - (void)testAdvertiserTrackingEnabledInAppEventPayload
}
}

- (void)testDropAppEvent
{
id mockAppEventsState = OCMClassMock([FBSDKAppEventsState class]);
OCMStub([mockAppEventsState alloc]).andReturn(mockAppEventsState);
OCMStub([mockAppEventsState initWithToken:OCMArg.any appID:OCMArg.any]).andReturn(mockAppEventsState);
[FBSDKSettings setAppID:@"123"];

OCMStub([_mockAppEventsUtility shouldDropAppEvent]).andReturn(YES);
[FBSDKAppEvents logEvent:@"event"];
OCMReject([mockAppEventsState addEvent:OCMArg.any isImplicit:NO]);
}

- (void)testSendAppEvent
{
id mockAppEventsState = OCMClassMock([FBSDKAppEventsState class]);
OCMStub([mockAppEventsState alloc]).andReturn(mockAppEventsState);
OCMStub([mockAppEventsState initWithToken:OCMArg.any appID:OCMArg.any]).andReturn(mockAppEventsState);
[FBSDKSettings setAppID:@"123"];

OCMStub([_mockAppEventsUtility shouldDropAppEvent]).andReturn(NO);
[FBSDKAppEvents logEvent:@"event"];
OCMVerify([mockAppEventsState addEvent:OCMArg.any isImplicit:NO]);
}

- (void)testIsSensitiveUserData
{
NSString *text = @"[email protected]";
Expand Down
4 changes: 2 additions & 2 deletions FBSDKCoreKit/FBSDKCoreKitTests/Internal/FBSDKSettingsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1153,14 +1153,14 @@ - (void)testFacebookAdvertiserTrackingStatusDefaultValue

- (void)testSettingFacebookAdvertiserTrackingStatus
{
[FBSDKSettings setAdvertiserTrackingStatus:FBSDKAdvertisingTrackingAllowed];

if (@available(iOS 14.0, *)) {
XCTAssertTrue([FBSDKSettings setAdvertiserTrackingEnabled:YES]);
XCTAssertTrue(
[FBSDKSettings getAdvertisingTrackingStatus] == FBSDKAdvertisingTrackingAllowed,
"Should use the explicitly set property"
);
} else {
XCTAssertFalse([FBSDKSettings setAdvertiserTrackingEnabled:YES]);
XCTAssertNil(
userDefaultsSpy.capturedValues[@"FacebookAdvertiserTrackingStatus"],
"Should be no-op in iOS13 and below"
Expand Down

0 comments on commit 3d02460

Please sign in to comment.