Skip to content

Commit

Permalink
Updated currentServerDate test - to show how to use PA timeService
Browse files Browse the repository at this point in the history
  • Loading branch information
Hopsaheysa committed Mar 5, 2024
1 parent de81cdc commit 408e8a4
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions WultraMobileTokenSDKTests/IntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,16 @@ class IntegrationTests: XCTestCase {
waitForExpectations(timeout: 20, handler: nil)
}

/// `currentServerDate` is nil by default and after ops fetch, it should be set
/// `currentServerDate` was removed from WMTOperations in favor of more precise powerAuth timeService
func testCurrentServerDate() {
let exp = expectation(description: "Server date should be set after operation fetch")
var synchronizedServerDate: Date? = nil

XCTAssertNil(self.ops.currentServerDate)

_ = ops.getOperations { result in

switch result {
case .success:
XCTAssertNotNil(self.ops.currentServerDate)
case .failure(let err):
XCTFail(err.description)
}
exp.fulfill()
let timeService = pa.timeSynchronizationService
if timeService.isTimeSynchronized {
synchronizedServerDate = Date(timeIntervalSince1970: timeService.currentTime())
}

waitForExpectations(timeout: 20, handler: nil)
XCTAssertNotNil(synchronizedServerDate)
}

/// Test of Login operation approval (1FA)
Expand Down

0 comments on commit 408e8a4

Please sign in to comment.