83 lines
1.4 KiB
Swift
83 lines
1.4 KiB
Swift
import Infrastructure
|
|
import Testing
|
|
|
|
@testable import WebsiteLibrary
|
|
|
|
@Suite(
|
|
"StaticFile enumeration",
|
|
.tags(.enumeration)
|
|
)
|
|
struct StaticFileTests {
|
|
|
|
// MARK: Type aliases
|
|
|
|
typealias File = StaticFile
|
|
|
|
// MARK: Computed tests
|
|
|
|
@Test(arguments: zip(
|
|
File.allCases,
|
|
Self.fileExtensions
|
|
))
|
|
func `file extensions`(
|
|
for file: File,
|
|
expects extensions: [AssetExtension]
|
|
) {
|
|
#expect(file.fileExtensions == extensions)
|
|
}
|
|
|
|
@Test(arguments: zip(
|
|
File.allCases,
|
|
Self.fileNames
|
|
))
|
|
func `file name`(
|
|
for file: File,
|
|
expects fileName: String
|
|
) {
|
|
#expect(file.fileName == fileName)
|
|
}
|
|
|
|
// MARK: CaseIterable tests
|
|
|
|
@Test
|
|
func `all cases`() {
|
|
#expect(File.allCases.count == 11)
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - Helpers
|
|
|
|
private extension StaticFileTests {
|
|
|
|
// MARK: Constants
|
|
|
|
static let fileExtensions: [[AssetExtension]] = [
|
|
[.png],
|
|
[.ico],
|
|
[.svg],
|
|
[.png],
|
|
[.png],
|
|
[.css, .js],
|
|
[.css, .js],
|
|
[.txt],
|
|
[.css, .js],
|
|
[.webmanifest],
|
|
[.xml]
|
|
]
|
|
static let fileNames: [String] = [
|
|
"apple-touch-icon",
|
|
"favicon",
|
|
"icon",
|
|
"icon-192",
|
|
"icon-512",
|
|
"index",
|
|
"not-found",
|
|
"robots",
|
|
"shared",
|
|
"site",
|
|
"sitemap"
|
|
]
|
|
|
|
}
|