Skip to content

Commit

Permalink
Try using Bundle to access test resources
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Feb 13, 2025
1 parent 3646d9a commit 285d3a9
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Tests/ZipTests/ZipTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import XCTest

final class ZipTests: XCTestCase {
private func url(forResource resource: String, withExtension ext: String? = nil) -> URL? {
let resourcePath = URL(fileURLWithPath: "\(FileManager.default.currentDirectoryPath)/Tests/ZipTests/TestResources/")
.appendingPathComponent(resource)
return ext.map { resourcePath.appendingPathExtension($0) } ?? resourcePath
Bundle.module.url(forResource: "TestResources/\(resource)", withExtension: ext)
}

private func autoRemovingSandbox() throws -> URL {
Expand All @@ -34,9 +32,6 @@ final class ZipTests: XCTestCase {

func testQuickUnzip() throws {
let filePath = url(forResource: "bb8", withExtension: "zip")!
print("❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌ - filePath: \(filePath.path)")
print(#file)
print(#filePath)
let destinationURL = try Zip.quickUnzipFile(filePath)
addTeardownBlock {
try? FileManager.default.removeItem(at: destinationURL)
Expand Down Expand Up @@ -294,7 +289,6 @@ final class ZipTests: XCTestCase {
let emptyArchiveFile = ArchiveFile(filename: "empty.txt", data: Data())
let sandboxFolder = try autoRemovingSandbox()
let zipFilePath = sandboxFolder.appendingPathComponent("archive.zip")
print("❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌ - zipFilePath: \(zipFilePath.path)")
try Zip.zipData(archiveFiles: [archiveFile1, archiveFile2, emptyArchiveFile], zipFilePath: zipFilePath)
XCTAssertTrue(FileManager.default.fileExists(atPath: zipFilePath.path))
}
Expand Down

0 comments on commit 285d3a9

Please sign in to comment.