Skip to content

Commit

Permalink
Check for remote state in restore and rename item from trash test
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
  • Loading branch information
claucambra committed Dec 13, 2024
1 parent 216016d commit ec9378e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Tests/NextcloudFileProviderKitTests/ItemModifyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1022,16 +1022,16 @@ final class ItemModifyTests: XCTestCase {
let folderMetadata = remoteFolder.toItemMetadata(account: Self.account)
Self.dbManager.addItemMetadata(folderMetadata)

let newContents = "I've changed!".data(using: .utf8)
let newContents = "I've changed!".data(using: .utf8)!
let newContentsUrl = FileManager.default.temporaryDirectory.appendingPathComponent("test")
try newContents?.write(to: newContentsUrl)
try newContents.write(to: newContentsUrl)

let targetItemMetadata = ItemMetadata(value: trashItemMetadata)
targetItemMetadata.serverUrl = Self.account.davFilesUrl
targetItemMetadata.fileName = "new-file.txt"
targetItemMetadata.fileNameView = "new-file.txt"
targetItemMetadata.name = "new-file.txt"
targetItemMetadata.size = Int64(newContents!.count)
targetItemMetadata.size = Int64(newContents.count)
targetItemMetadata.trashbinFileName = ""
targetItemMetadata.trashbinOriginalLocation = ""
targetItemMetadata.trashbinDeletionTime = Date()
Expand Down Expand Up @@ -1066,6 +1066,9 @@ final class ItemModifyTests: XCTestCase {
XCTAssertEqual(modifiedUntrashedItem.itemIdentifier, targetItem.itemIdentifier)
XCTAssertEqual(modifiedUntrashedItem.filename, targetItem.filename)
XCTAssertEqual(modifiedUntrashedItem.documentSize?.int64Value, targetItemMetadata.size)

XCTAssertEqual(remoteTrashItem.name, targetItem.filename)
XCTAssertEqual(remoteTrashItem.data!, newContents)
}

func testMoveFileOutOfTrashWithExistingIdenticallyNamedFile() async throws {
Expand Down

0 comments on commit ec9378e

Please sign in to comment.