@@ -22,11 +22,9 @@ final class TUSClientInternalTests: XCTestCase {
2222
2323 do {
2424 relativeStoragePath = URL ( string: " TUSTEST " ) !
25-
26- let docDir = FileManager . default. urls ( for: . documentDirectory, in: . userDomainMask) [ 0 ]
27- fullStoragePath = docDir. appendingPathComponent ( relativeStoragePath. absoluteString)
28- files = try Files ( storageDirectory: fullStoragePath)
29- clearDirectory ( dir: fullStoragePath)
25+ files = try Files ( storageDirectory: relativeStoragePath)
26+ fullStoragePath = files. storageDirectory
27+ clearDirectory ( dir: files. storageDirectory)
3028
3129 data = Data ( " abcdef " . utf8)
3230
@@ -124,6 +122,21 @@ final class TUSClientInternalTests: XCTestCase {
124122 }
125123 }
126124
125+ func testCancelAndDeleteRemovesCacheAndPreventsResume( ) throws {
126+ let clientFiles = try Files ( storageDirectory: relativeStoragePath)
127+ let id = UUID ( )
128+ let path = try clientFiles. store ( data: data, id: id)
129+ let metaData = UploadMetadata ( id: id, filePath: path, uploadURL: URL ( string: " io.tus " ) !, size: data. count, customHeaders: [ : ] , mimeType: nil )
130+ try clientFiles. encodeAndStore ( metaData: metaData)
131+
132+ let deleted = try client. cancelAndDelete ( id: id)
133+ XCTAssertTrue ( deleted)
134+ XCTAssertNil ( try clientFiles. findMetadata ( id: id) )
135+
136+ let resumed = client. start ( )
137+ XCTAssertTrue ( resumed. isEmpty)
138+ }
139+
127140 func testCancellationDoesNotIncrementErrorCountOrRetry( ) throws {
128141 let metaData = try storeFiles ( )
129142 let creationTask = try CreationTask ( metaData: metaData,
0 commit comments