Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UnitTests/MParticle+PrivateMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- (void)configureWithOptions:(MParticleOptions * _Nonnull)options;
- (void)startWithKeyCallback:(BOOL)firstRun options:(MParticleOptions * _Nonnull)options userDefaults:(id<MPUserDefaultsProtocol>)userDefaults;
- (void)beginTimedEventCompletionHandler:(MPEvent *)event execStatus:(MPExecStatus)execStatus;
- (void)logEventCallback:(MPEvent *)event execStatus:(MPExecStatus)execStatus;

@property (nonatomic, strong, nonnull) MPBackendController_PRIVATE *backendController;
@property (nonatomic, strong) id<SettingsProviderProtocol> settingsProvider;
Expand Down
27 changes: 27 additions & 0 deletions UnitTests/MParticleTestsSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class MParticleTestsSwift: XCTestCase {
override func tearDown() {
super.tearDown()
receivedMessage = nil
mparticle.dataPlanFilter = nil
}

func testSetOptOutCompletionSuccess() {
Expand Down Expand Up @@ -171,4 +172,30 @@ class MParticleTestsSwift: XCTestCase {
"""
)
}

func testLogEventCallbackDataFilterNotSet() {
XCTAssertNil(mparticle.dataPlanFilter)
mparticle.logEventCallback(MPEvent(), execStatus: .success)

XCTAssertNil(receivedMessage)
}

func testLogEventCallbackrDataFilterSetDataFilterReturnNil() {
let dataPlanFilter = MPDataPlanFilterMock()
mparticle.dataPlanFilter = dataPlanFilter
let expectedEvent = MPEvent()
mparticle.logEventCallback(expectedEvent, execStatus: .success)

XCTAssert(dataPlanFilter.transformEventCalled)
XCTAssertTrue(dataPlanFilter.transformEventEventParam === expectedEvent)

XCTAssertEqual(receivedMessage, """
mParticle -> Blocked timed event end from kits: Event:{
Name: <<Event With No Name>>
Type: Other
Duration: 0
}
"""
)
}
}