Move the app payload under swift/ while keeping git, package.json, and .smartconfig.json at the repo root. This standardizes the Swift app setup so build, test, run, and watch workflows match the other repos.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import XCTest
|
||||
@testable import IDPGlobal
|
||||
|
||||
final class OneTimePasscodeGeneratorTests: XCTestCase {
|
||||
func testCodeStaysStableWithinWindow() {
|
||||
let firstDate = Date(timeIntervalSince1970: 60)
|
||||
let secondDate = Date(timeIntervalSince1970: 89)
|
||||
let nextWindowDate = Date(timeIntervalSince1970: 90)
|
||||
|
||||
let firstCode = OneTimePasscodeGenerator.code(for: "pairing-payload", at: firstDate)
|
||||
let secondCode = OneTimePasscodeGenerator.code(for: "pairing-payload", at: secondDate)
|
||||
let nextWindowCode = OneTimePasscodeGenerator.code(for: "pairing-payload", at: nextWindowDate)
|
||||
|
||||
XCTAssertEqual(firstCode, secondCode)
|
||||
XCTAssertNotEqual(firstCode, nextWindowCode)
|
||||
}
|
||||
|
||||
func testRenewalCountdownResetsAtBoundary() {
|
||||
XCTAssertEqual(OneTimePasscodeGenerator.renewalCountdown(at: Date(timeIntervalSince1970: 90)), 30)
|
||||
XCTAssertEqual(OneTimePasscodeGenerator.renewalCountdown(at: Date(timeIntervalSince1970: 119)), 1)
|
||||
XCTAssertEqual(OneTimePasscodeGenerator.renewalCountdown(at: Date(timeIntervalSince1970: 120)), 30)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user