Renamed the ResourceFile enumeration in the library target as File and also, implemented its "filePath" and "resourcePath" properties.

This commit is contained in:
2025-01-18 11:50:26 +01:00
parent 720ad687fb
commit f558465b62
6 changed files with 118 additions and 56 deletions
@@ -0,0 +1,70 @@
import Testing
@testable import ColibriLibrary
struct FileTests {
// MARK: Properties tests
@Test(arguments: zip(File.allCases, Expectation.fileNames))
func fileName(for file: File, expects fileName: String) async throws {
// GIVEN
// WHEN
let result = file.fileName
// THEN
#expect(result == fileName)
}
@Test(arguments: zip(File.allCases, Expectation.filePaths))
func filePath(for file: File, expects filePath: String) async throws {
// GIVEN
// WHEN
let result = file.filePath
// THEN
#expect(result == filePath)
}
@Test(arguments: zip(File.allCases, Expectation.resourcePaths))
func resourcePath(for file: File, expects resourcePath: String) async throws {
// GIVEN
// WHEN
let result = file.resourcePath
// THEN
#expect(result == resourcePath)
}
}
// MARK: - Expectations
private extension FileTests {
enum Expectation {
static let fileNames: [String] = [
".dockerignore",
".gitignore",
"LICENSE",
"Package.swift",
"README.md"
]
static let filePaths: [String] = [
".dockerignore",
".gitignore",
"LICENSE",
"Package.swift",
"README.md"
]
static let resourcePaths: [String] = [
"Resources/Files",
"Resources/Files",
"Resources/Files",
"Resources/Files",
"Resources/Files"
]
}
}
@@ -1,20 +0,0 @@
import Testing
@testable import ColibriLibrary
struct ResourceFileTests {
// MARK: Properties tests
@Test(arguments: zip(ResourceFile.allCases,
[".dockerignore", ".gitignore", "LICENSE", "Package.swift", "README.md"]))
func fileName(for resource: ResourceFile, expects fileName: String) async throws {
// GIVEN
// WHEN
let result = resource.fileName
// THEN
#expect(result == fileName)
}
}