Documented the AssetPrefix enumeration in the library target.

This commit is contained in:
Javier Cicchelli 2025-03-04 23:36:04 +01:00
parent 65415fad52
commit d59b64afdb
2 changed files with 52 additions and 1 deletions

View File

@ -1,11 +1,20 @@
/// An enumeration that represents all possible static assets folder where assets included into the `DocC`catalog and code generated by the `DocC` building process. will be stored.
enum AssetPrefix: String, CaseIterable {
/// A folder that contains all CSS code generated by the `DocC` building process.
case css
/// A folder that contains all documentation data extracted from the source code by the `DocC` building process.
case data
/// A folder that contains all other resources included into the `DocC` documentation catalog.
case downloads
/// A folder that contains all image resources included into the `DocC` documentation catalog.
case images
/// A folder that contains all image resources included into the `DocC` documentation catalog.
case img
/// A folder that contains all `HTML` code generated by the `DocC` building process.
case index
/// A folder that contains all `Javascript` code generated by the `DocC` building process.
case js
/// A folder that contains all video resources included into the `DocC` documentation catalog.
case videos
}
@ -16,7 +25,7 @@ extension AssetPrefix: Pathable {
// MARK: Computed
var path: String {
.init(format: .Format.pathRoot, rawValue)
.init(format: .Format.Path.root, rawValue)
}
}

View File

@ -0,0 +1,42 @@
import Testing
@testable import AppLibrary
@Suite("AssetPrefix")
struct AssetPrefixTests {
// MARK: Properties tests
@Test(arguments: zip(AssetPrefix.allCases, [String].paths))
func path(
for prefix: AssetPrefix,
expects pathExpected: String
) async throws {
// GIVEN
// WHEN
let path = prefix.path
// THEN
#expect(path == pathExpected)
}
}
// MARK: - Collection+Strings
private extension Collection where Element == String {
// MARK: Properties
static var paths: [Element] {[
"/css",
"/data",
"/downloads",
"/images",
"/img",
"/index",
"/js",
"/videos"
]}
}