From d59b64afdb246bb3dbc5917993392232822959a4 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 4 Mar 2025 23:36:04 +0100 Subject: [PATCH] Documented the AssetPrefix enumeration in the library target. --- .../Internal/Enumerations/AssetPrefix.swift | 11 ++++- .../Enumerations/AssetPrefixTests.swift | 42 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Test/Sources/Cases/Internal/Enumerations/AssetPrefixTests.swift diff --git a/Library/Sources/Internal/Enumerations/AssetPrefix.swift b/Library/Sources/Internal/Enumerations/AssetPrefix.swift index 6dff450..621859e 100644 --- a/Library/Sources/Internal/Enumerations/AssetPrefix.swift +++ b/Library/Sources/Internal/Enumerations/AssetPrefix.swift @@ -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) } } diff --git a/Test/Sources/Cases/Internal/Enumerations/AssetPrefixTests.swift b/Test/Sources/Cases/Internal/Enumerations/AssetPrefixTests.swift new file mode 100644 index 0000000..15ccda5 --- /dev/null +++ b/Test/Sources/Cases/Internal/Enumerations/AssetPrefixTests.swift @@ -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" + ]} + +}