@@ -36,12 +36,12 @@ struct TabDiskActorTests {
3636 // MARK: - save / load round-trip
3737
3838 @Test ( " Save then load round-trips correctly " )
39- func saveAndLoadRoundTrip( ) async {
39+ func saveAndLoadRoundTrip( ) async throws {
4040 let connectionId = UUID ( )
4141 let tabId = UUID ( )
4242 let tab = makeTab ( id: tabId, title: " My Tab " , query: " SELECT * FROM users " )
4343
44- await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: tabId)
44+ try await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: tabId)
4545 let state = await actor . load ( connectionId: connectionId)
4646
4747 #expect( state != nil )
@@ -58,21 +58,21 @@ struct TabDiskActorTests {
5858 // MARK: - load returns nil for unknown connectionId
5959
6060 @Test ( " Load returns nil for unknown connectionId " )
61- func loadReturnsNilForUnknown( ) async {
61+ func loadReturnsNilForUnknown( ) async throws {
6262 let result = await actor . load ( connectionId: UUID ( ) )
6363 #expect( result == nil )
6464 }
6565
6666 // MARK: - save overwrites previous state
6767
6868 @Test ( " Save overwrites previous state " )
69- func saveOverwritesPreviousState( ) async {
69+ func saveOverwritesPreviousState( ) async throws {
7070 let connectionId = UUID ( )
7171 let tab1 = makeTab ( title: " First " )
7272 let tab2 = makeTab ( title: " Second " )
7373
74- await actor . save ( connectionId: connectionId, tabs: [ tab1] , selectedTabId: tab1. id)
75- await actor . save ( connectionId: connectionId, tabs: [ tab2] , selectedTabId: tab2. id)
74+ try await actor . save ( connectionId: connectionId, tabs: [ tab1] , selectedTabId: tab1. id)
75+ try await actor . save ( connectionId: connectionId, tabs: [ tab2] , selectedTabId: tab2. id)
7676
7777 let state = await actor . load ( connectionId: connectionId)
7878
@@ -86,11 +86,11 @@ struct TabDiskActorTests {
8686 // MARK: - clear removes saved state
8787
8888 @Test ( " Clear removes saved state " )
89- func clearRemovesSavedState( ) async {
89+ func clearRemovesSavedState( ) async throws {
9090 let connectionId = UUID ( )
9191 let tab = makeTab ( )
9292
93- await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: tab. id)
93+ try await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: tab. id)
9494 await actor . clear ( connectionId: connectionId)
9595
9696 let state = await actor . load ( connectionId: connectionId)
@@ -100,21 +100,21 @@ struct TabDiskActorTests {
100100 // MARK: - clear on non-existent connectionId does not crash
101101
102102 @Test ( " Clear on non-existent connectionId does not crash " )
103- func clearNonExistentDoesNotCrash( ) async {
103+ func clearNonExistentDoesNotCrash( ) async throws {
104104 await actor . clear ( connectionId: UUID ( ) )
105105 }
106106
107107 // MARK: - Multiple connections are independent
108108
109109 @Test ( " Multiple connections are independent " )
110- func multipleConnectionsAreIndependent( ) async {
110+ func multipleConnectionsAreIndependent( ) async throws {
111111 let connA = UUID ( )
112112 let connB = UUID ( )
113113 let tabA = makeTab ( title: " Tab A " )
114114 let tabB = makeTab ( title: " Tab B " )
115115
116- await actor . save ( connectionId: connA, tabs: [ tabA] , selectedTabId: tabA. id)
117- await actor . save ( connectionId: connB, tabs: [ tabB] , selectedTabId: tabB. id)
116+ try await actor . save ( connectionId: connA, tabs: [ tabA] , selectedTabId: tabA. id)
117+ try await actor . save ( connectionId: connB, tabs: [ tabB] , selectedTabId: tabB. id)
118118
119119 let stateA = await actor . load ( connectionId: connA)
120120 let stateB = await actor . load ( connectionId: connB)
@@ -135,18 +135,18 @@ struct TabDiskActorTests {
135135 // MARK: - selectedTabId preservation
136136
137137 @Test ( " selectedTabId is preserved correctly including nil " )
138- func selectedTabIdPreserved( ) async {
138+ func selectedTabIdPreserved( ) async throws {
139139 let connectionId = UUID ( )
140140 let tab = makeTab ( )
141141
142- await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: nil )
142+ try await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: nil )
143143 let stateNil = await actor . load ( connectionId: connectionId)
144144 #expect( stateNil? . selectedTabId == nil )
145145 #expect( stateNil? . tabs. count == 1 )
146146
147147 let specificId = UUID ( )
148148 let tab2 = makeTab ( id: specificId)
149- await actor . save ( connectionId: connectionId, tabs: [ tab2] , selectedTabId: specificId)
149+ try await actor . save ( connectionId: connectionId, tabs: [ tab2] , selectedTabId: specificId)
150150 let stateWithId = await actor . load ( connectionId: connectionId)
151151 #expect( stateWithId? . selectedTabId == specificId)
152152
@@ -156,7 +156,7 @@ struct TabDiskActorTests {
156156 // MARK: - saveLastQuery / loadLastQuery round-trip
157157
158158 @Test ( " saveLastQuery then loadLastQuery round-trips " )
159- func lastQueryRoundTrip( ) async {
159+ func lastQueryRoundTrip( ) async throws {
160160 let connectionId = UUID ( )
161161 let query = " SELECT * FROM products WHERE active = true "
162162
@@ -171,15 +171,15 @@ struct TabDiskActorTests {
171171 // MARK: - loadLastQuery returns nil for unknown connectionId
172172
173173 @Test ( " loadLastQuery returns nil for unknown connectionId " )
174- func loadLastQueryReturnsNilForUnknown( ) async {
174+ func loadLastQueryReturnsNilForUnknown( ) async throws {
175175 let result = await actor . loadLastQuery ( for: UUID ( ) )
176176 #expect( result == nil )
177177 }
178178
179179 // MARK: - saveLastQuery with empty string removes the file
180180
181181 @Test ( " saveLastQuery with empty string removes the file " )
182- func saveLastQueryEmptyRemovesFile( ) async {
182+ func saveLastQueryEmptyRemovesFile( ) async throws {
183183 let connectionId = UUID ( )
184184
185185 await actor . saveLastQuery ( " SELECT 1 " , for: connectionId)
@@ -193,7 +193,7 @@ struct TabDiskActorTests {
193193 // MARK: - saveLastQuery with whitespace-only string removes the file
194194
195195 @Test ( " saveLastQuery with whitespace-only string removes the file " )
196- func saveLastQueryWhitespaceOnlyRemovesFile( ) async {
196+ func saveLastQueryWhitespaceOnlyRemovesFile( ) async throws {
197197 let connectionId = UUID ( )
198198
199199 await actor . saveLastQuery ( " SELECT 1 " , for: connectionId)
@@ -206,7 +206,7 @@ struct TabDiskActorTests {
206206 // MARK: - saveLastQuery skips queries exceeding 500KB
207207
208208 @Test ( " saveLastQuery skips queries exceeding 500KB " )
209- func saveLastQuerySkipsLargeQueries( ) async {
209+ func saveLastQuerySkipsLargeQueries( ) async throws {
210210 let connectionId = UUID ( )
211211 let smallQuery = " SELECT 1 "
212212
@@ -225,7 +225,7 @@ struct TabDiskActorTests {
225225 // MARK: - Tab with all fields round-trips
226226
227227 @Test ( " Tab with all fields including isView and databaseName round-trips " )
228- func tabWithAllFieldsRoundTrips( ) async {
228+ func tabWithAllFieldsRoundTrips( ) async throws {
229229 let connectionId = UUID ( )
230230 let tabId = UUID ( )
231231 let tab = makeTab (
@@ -238,7 +238,7 @@ struct TabDiskActorTests {
238238 databaseName: " production "
239239 )
240240
241- await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: tabId)
241+ try await actor . save ( connectionId: connectionId, tabs: [ tab] , selectedTabId: tabId)
242242 let state = await actor . load ( connectionId: connectionId)
243243
244244 #expect( state != nil )
@@ -257,13 +257,13 @@ struct TabDiskActorTests {
257257 // MARK: - Multiple tabs in single save
258258
259259 @Test ( " Multiple tabs in a single save round-trip correctly " )
260- func multipleTabsRoundTrip( ) async {
260+ func multipleTabsRoundTrip( ) async throws {
261261 let connectionId = UUID ( )
262262 let tab1 = makeTab ( title: " Tab 1 " , tabType: . query)
263263 let tab2 = makeTab ( title: " Tab 2 " , tabType: . table, tableName: " orders " )
264264 let tab3 = makeTab ( title: " Tab 3 " , tabType: . query)
265265
266- await actor . save ( connectionId: connectionId, tabs: [ tab1, tab2, tab3] , selectedTabId: tab2. id)
266+ try await actor . save ( connectionId: connectionId, tabs: [ tab1, tab2, tab3] , selectedTabId: tab2. id)
267267 let state = await actor . load ( connectionId: connectionId)
268268
269269 #expect( state? . tabs. count == 3 )
@@ -278,7 +278,7 @@ struct TabDiskActorTests {
278278 // MARK: - saveSync writes data readable by load
279279
280280 @Test ( " saveSync writes data that load can read back " )
281- func saveSyncWritesReadableData( ) async {
281+ func saveSyncWritesReadableData( ) async throws {
282282 let connectionId = UUID ( )
283283 let tabId = UUID ( )
284284 let tab = makeTab ( id: tabId, title: " Sync Tab " , query: " SELECT 42 " , tabType: . table, tableName: " orders " )
@@ -301,10 +301,10 @@ struct TabDiskActorTests {
301301 // MARK: - Empty tabs array
302302
303303 @Test ( " Saving empty tabs array round-trips " )
304- func emptyTabsArrayRoundTrips( ) async {
304+ func emptyTabsArrayRoundTrips( ) async throws {
305305 let connectionId = UUID ( )
306306
307- await actor . save ( connectionId: connectionId, tabs: [ ] , selectedTabId: nil )
307+ try await actor . save ( connectionId: connectionId, tabs: [ ] , selectedTabId: nil )
308308 let state = await actor . load ( connectionId: connectionId)
309309
310310 #expect( state != nil )
0 commit comments