Skip to content

Commit a6a9642

Browse files
committed
test(app): update AppFeatureTests for multi-tab API
1 parent e0b0289 commit a6a9642

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

StorefrontTests/AppFeatureTests.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,41 @@ final class AppFeatureTests: XCTestCase {
1313
}
1414
}
1515

16-
func testFileImportedOpensBrowser() async {
16+
func testFileImportedAppendsTab() async {
1717
let url = URL(fileURLWithPath: "/tmp/sample.sqlite")
1818
let store = TestStore(
1919
initialState: AppFeature.State(isFileImporterPresented: true)
2020
) {
2121
AppFeature()
22+
} withDependencies: {
23+
$0.uuid = .incrementing
2224
}
2325
store.exhaustivity = .off
2426

27+
let expectedID = UUID(uuidString: "00000000-0000-0000-0000-000000000000")!
28+
2529
await store.send(.fileImported(url)) {
2630
$0.isFileImporterPresented = false
27-
$0.browser = BrowserFeature.State(databaseURL: url)
31+
$0.tabs = [BrowserTab.State(id: expectedID, databaseURL: url)]
32+
$0.selectedTabID = expectedID
2833
}
2934
}
3035

31-
func testCloseDocumentClearsBrowser() async {
36+
func testCloseCurrentTabRemovesSelectedTab() async {
3237
let url = URL(fileURLWithPath: "/tmp/sample.sqlite")
38+
let id = UUID(uuidString: "00000000-0000-0000-0000-000000000001")!
3339
let store = TestStore(
3440
initialState: AppFeature.State(
35-
browser: BrowserFeature.State(databaseURL: url)
41+
tabs: [BrowserTab.State(id: id, databaseURL: url)],
42+
selectedTabID: id
3643
)
3744
) {
3845
AppFeature()
3946
}
4047

41-
await store.send(.closeDocument) {
42-
$0.browser = nil
48+
await store.send(.closeCurrentTab) {
49+
$0.tabs = []
50+
$0.selectedTabID = nil
4351
}
4452
}
4553
}

0 commit comments

Comments
 (0)