         XCTAssert(contents.isEmpty, "Expected the client to delete the file")
     }
 
-    func testClientDeletesFilesOnCompletion() {
+    func testClientDeletesFilesOnCompletion() throws {
         // If a file is done uploading (as said by status), but not yet deleted.
         // Then the file can be deleted right after fetching the status.
-        XCTFail("Implement me")
+        
+        let cacheDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]
+            let data = Data("abcdef".utf8)
+        // Store file in cache
+        func storeFileInCache() throws -> URL {
+            let targetLocation = cacheDir.appendingPathComponent("myfile.txt")
+            try data.write(to: targetLocation)
+            return targetLocation
+        }
+        
+        prepareNetworkForSuccesfulUploads(data: data)
+        
+        var contents = try FileManager.default.contentsOfDirectory(at: fullStoragePath, includingPropertiesForKeys: nil)
+        XCTAssert(contents.isEmpty)
+        
+        let uploadCount = 5
+        for _ in 0..<uploadCount {
+            let url = try storeFileInCache()
+            try client.uploadFileAt(filePath: url)
+        }
+        
+        contents = try FileManager.default.contentsOfDirectory(at: fullStoragePath, includingPropertiesForKeys: nil)
+        XCTAssertEqual(uploadCount * 2, contents.count) // Every upload has a metadata file
+        
+        let expectation = expectation(description: "Waiting for upload to finished")
+        expectation.expectedFulfillmentCount = uploadCount
+        tusDelegate.finishUploadExpectation = expectation
+        waitForExpectations(timeout: 3, handler: nil)
+        XCTAssertEqual(5, tusDelegate.finishedUploads.count)
+        
+        contents = try FileManager.default.contentsOfDirectory(at: fullStoragePath, includingPropertiesForKeys: nil)
+        XCTAssert(contents.isEmpty)
     }
     
     func testDeleteUploadedFilesOnStartup() {

        configuration.protocolClasses = [MockURLProtocol.self]
        return TUSClient(config: TUSConfig(server: liveDemoPath), sessionIdentifier: "TEST", storageDirectory: relativeStoragePath, session: URLSession.init(configuration: configuration))
    }

    
    // MARK: - Adding files and data to upload
    

        try XCTAssertThrowsError(client.upload(data: data))
    }
    
    // MARK: - File handling
    
    func testClientCanHandleDirectoryStartingWithOrWithoutForwardSlash() {
