Skip to content

Commit 5a0f464

Browse files
author
Ruben Nine
committed
Ensure deleteTemporaryFilesAfterUpload is true for tests.
Fulfill expectation only after checking that file should/should not exist.
1 parent 7c48f73 commit 5a0f464

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Tests/FilestackSDKTests/UploadTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,17 @@ class UploadTests: XCTestCase {
359359

360360
let uploadOptions = UploadOptions(preferIntelligentIngestion: false,
361361
startImmediately: true,
362-
deleteTemporaryFilesAfterUpload: false,
362+
deleteTemporaryFilesAfterUpload: true,
363363
storeOptions: defaultStoreOptions)
364364

365365
let uploader = client.upload(using: temporaryURL, options: uploadOptions) { resp in
366366
XCTAssertTrue(fm.fileExists(atPath: temporaryURL.path), "File should exist")
367367

368368
response = resp
369-
expectation.fulfill()
370369

371370
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
372371
XCTAssertFalse(fm.fileExists(atPath: temporaryURL.path), "File should no longer exist")
372+
expectation.fulfill()
373373
}
374374
}
375375

@@ -392,17 +392,17 @@ class UploadTests: XCTestCase {
392392

393393
let uploadOptions = UploadOptions(preferIntelligentIngestion: false,
394394
startImmediately: true,
395-
deleteTemporaryFilesAfterUpload: false,
395+
deleteTemporaryFilesAfterUpload: true,
396396
storeOptions: defaultStoreOptions)
397397

398398
let uploader = client.upload(using: largeFileURL, options: uploadOptions) { resp in
399399
XCTAssertTrue(fm.fileExists(atPath: self.largeFileURL.path), "File should exist")
400400

401401
response = resp
402-
expectation.fulfill()
403402

404403
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
405-
XCTAssertFalse(fm.fileExists(atPath: self.largeFileURL.path), "File should still exist")
404+
XCTAssertTrue(fm.fileExists(atPath: self.largeFileURL.path), "File should still exist")
405+
expectation.fulfill()
406406
}
407407
}
408408

0 commit comments

Comments
 (0)