71 lines
1.6 KiB
Swift
71 lines
1.6 KiB
Swift
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"
|
|
]
|
|
}
|
|
}
|
|
|