Skip to content

Commit

Permalink
Merge 61594d8 into d3d350e
Browse files Browse the repository at this point in the history
  • Loading branch information
paultopher committed Aug 12, 2020
2 parents d3d350e + 61594d8 commit 5b9b9ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/Core.swift
Expand Up @@ -177,7 +177,7 @@ final internal class Core: CoreType {
completion(nil, nil)
return
}
self?.buttonDefaults.attributionToken = token
self?.updateAttributionIfNeeded(token: token)
completion(url, nil)
}
}
Expand Down
10 changes: 9 additions & 1 deletion Tests/UnitTests/CoreTests.swift
Expand Up @@ -360,10 +360,11 @@ class CoreTests: XCTestCase {
let expectation = XCTestExpectation(description: "handle post install url")
let testDefaults = TestButtonDefaults(userDefaults: TestUserDefaults())
let testSystem = TestSystem()
let testNotificationCenter = TestNotificationCenter()
let core = Core(buttonDefaults: testDefaults,
client: testClient,
system: testSystem,
notificationCenter: TestNotificationCenter())
notificationCenter: testNotificationCenter)
testDefaults.testHasFetchedPostInstallURL = false
testSystem.testIsNewInstall = true
core.applicationId = ApplicationId("app-123")
Expand All @@ -378,6 +379,13 @@ class CoreTests: XCTestCase {
XCTAssertTrue(testDefaults.didStoreToken)
XCTAssertNotNil(testDefaults.attributionToken)
XCTAssertEqual(testDefaults.attributionToken, expectedToken)
XCTAssertEqual(core.attributionToken, expectedToken)
XCTAssertTrue(testNotificationCenter.didCallPostNotification)
XCTAssertNil(testNotificationCenter.testObject)
XCTAssertEqual(testNotificationCenter.testNotificationName,
Notification.Name.Button.AttributionTokenDidChange)
XCTAssertEqual(testNotificationCenter.testUserInfo! as NSDictionary,
[Notification.Key.NewToken: expectedToken])
expectation.fulfill()
}
XCTAssertEqual(testClient.testParameters as NSDictionary,
Expand Down

0 comments on commit 5b9b9ca

Please sign in to comment.