75 lines
1.3 KiB
Swift
75 lines
1.3 KiB
Swift
import Testing
|
|
|
|
@testable import Infrastructure
|
|
|
|
@Suite(
|
|
"AssetExtension enumeration",
|
|
.tags(.asset)
|
|
)
|
|
struct AssetExtensionTests {
|
|
|
|
// MARK: Computed tests
|
|
|
|
@Test(arguments: zip(
|
|
Self.extensions,
|
|
Self.contentTypes
|
|
))
|
|
func `content type`(
|
|
for fileExtension: AssetExtension,
|
|
expects contentType: String
|
|
) {
|
|
#expect(fileExtension.contentType == contentType)
|
|
}
|
|
|
|
@Test(arguments: zip(
|
|
Self.extensions,
|
|
Self.folders
|
|
))
|
|
func `folder`(
|
|
for fileExtension: AssetExtension,
|
|
expects folder: String?
|
|
) {
|
|
#expect(fileExtension.folder == folder)
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - Helpers
|
|
|
|
private extension AssetExtensionTests {
|
|
|
|
// MARK: Constants
|
|
|
|
static let extensions: [AssetExtension] = [
|
|
.css,
|
|
.js,
|
|
.png,
|
|
.ico,
|
|
.svg,
|
|
.txt,
|
|
.webmanifest,
|
|
.xml
|
|
]
|
|
static let contentTypes: [String] = [
|
|
"text/css",
|
|
"text/javascript",
|
|
"image/png",
|
|
"image/vnd.microsoft.icon",
|
|
"image/svg+xml",
|
|
"text/plain",
|
|
"application/manifest+json",
|
|
"application/xml"
|
|
]
|
|
static let folders: [String?] = [
|
|
"css",
|
|
"js",
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil,
|
|
nil
|
|
]
|
|
|
|
}
|