Skip to content

Commit 87cf27a

Browse files
committed
Fix tests
1 parent 3b63aea commit 87cf27a

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

AuthenticatorTests/RootTests.swift

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class RootTests: XCTestCase {
5353
// Ensure the backup info modal is visible.
5454
let secondViewModel = root.viewModel(for: [], at: displayTime)
5555
switch secondViewModel.modal {
56-
case .info(let infoViewModel):
56+
case .info(_, .some(let infoViewModel)):
5757
XCTAssert(infoViewModel.title == "Backups")
5858
default:
5959
XCTFail("Expected Backups .info, got \(secondViewModel.modal)")
@@ -88,8 +88,26 @@ class RootTests: XCTestCase {
8888
return
8989
}
9090

91+
// Show the info list.
92+
let showInfoAction: Root.Action = .tokenListAction(.showInfo)
93+
let showInfoEffect: Root.Effect?
94+
do {
95+
showInfoEffect = try root.update(showInfoAction)
96+
} catch {
97+
XCTFail("Unexpected error: \(error)")
98+
return
99+
}
100+
XCTAssertNil(showInfoEffect)
101+
102+
// Ensure the info list modal is visible.
103+
let nextViewModel = root.viewModel(for: [], at: displayTime)
104+
guard case .info(_, .none) = nextViewModel.modal else {
105+
XCTFail("Expected .info list, got \(nextViewModel.modal)")
106+
return
107+
}
108+
91109
// Show the license info.
92-
let showAction: Root.Action = .tokenListAction(.showLicenseInfo)
110+
let showAction: Root.Action = .infoListEffect(.showLicenseInfo)
93111
let showEffect: Root.Effect?
94112
do {
95113
showEffect = try root.update(showAction)
@@ -102,7 +120,7 @@ class RootTests: XCTestCase {
102120
// Ensure the license info modal is visible.
103121
let secondViewModel = root.viewModel(for: [], at: displayTime)
104122
switch secondViewModel.modal {
105-
case .info(let infoViewModel):
123+
case .info(_, .some(let infoViewModel)):
106124
XCTAssert(infoViewModel.title == "Acknowledgements")
107125
default:
108126
XCTFail("Expected Acknowledgements .info, got \(secondViewModel.modal)")

AuthenticatorTests/TokenListTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ class TokenListTests: XCTestCase {
7777
}
7878
}
7979

80-
func testActionShowLicenseInfo() {
80+
func testActionShowInfo() {
8181
var tokenList = TokenList()
82-
let action: TokenList.Action = .showLicenseInfo
82+
let action: TokenList.Action = .showInfo
8383
let effect = tokenList.update(action)
8484
// TODO: check that the token list hasn't changed
8585

8686
switch effect {
87-
case .some(.showLicenseInfo):
87+
case .some(.showInfo):
8888
break
8989
default:
9090
XCTFail("Expected .showLicenseInfo, got \(String(describing: effect))")
@@ -140,8 +140,8 @@ class TokenListTests: XCTestCase {
140140
XCTAssert(TokenList.Action.showBackupInfo != .beginAddToken)
141141

142142
// ShowLicenseInfo
143-
XCTAssert(TokenList.Action.showLicenseInfo == .showLicenseInfo)
144-
XCTAssert(TokenList.Action.showLicenseInfo != .beginAddToken)
143+
XCTAssert(TokenList.Action.showInfo == .showInfo)
144+
XCTAssert(TokenList.Action.showInfo != .beginAddToken)
145145
}
146146
}
147147

0 commit comments

Comments
 (0)