Improved the naming of some test cases for Swift below 6.2 in the tests target.
This commit is contained in:
@@ -43,7 +43,7 @@ struct LoggerMetadata_HelpersTests {
|
||||
}
|
||||
#else
|
||||
@Test("metadata with HTTP method and status code")
|
||||
func metadataWithMethodAndStatusCode() throws {
|
||||
func metadata_withMethod_andStatusCode() throws {
|
||||
assertMetadata(
|
||||
method: try randomMethod,
|
||||
statusCode: try randomStatusCode
|
||||
@@ -51,7 +51,7 @@ struct LoggerMetadata_HelpersTests {
|
||||
}
|
||||
|
||||
@Test("metadata with HTTP method, status code and redirection URI path")
|
||||
func metadataWithMethodStatusCodeAndRedirection() throws {
|
||||
func metadata_withMethod_statusCode_andRedirection() throws {
|
||||
assertMetadata(
|
||||
method: try randomMethod,
|
||||
statusCode: try randomStatusCode,
|
||||
|
||||
@@ -52,7 +52,7 @@ struct CheckURIUseCaseTests {
|
||||
Input.nonEncodedURIs,
|
||||
Output.nonEncodedURIs
|
||||
))
|
||||
func checkNonEncodedURIs(
|
||||
func check_nonEncodedURIs(
|
||||
uri uriPath: String,
|
||||
expects result: String?
|
||||
) {
|
||||
@@ -63,7 +63,7 @@ struct CheckURIUseCaseTests {
|
||||
Input.percentEncodedURIs,
|
||||
Output.percentEncodedURIs
|
||||
))
|
||||
func checkPercentEncodedURIs(
|
||||
func check_percentEncodedURIs(
|
||||
uri uriPath: String,
|
||||
expects result: String?
|
||||
) {
|
||||
|
||||
@@ -54,7 +54,7 @@ struct PrepareURIPathUseCaseTests {
|
||||
Input.prepareURIPaths,
|
||||
Output.prepareURIPaths
|
||||
))
|
||||
func dataWithURIRootNotSuffixedWithForwardSlash(
|
||||
func data_withURIRoot_notSuffixed_withForwardSlash(
|
||||
uri uriPath: String,
|
||||
expects result: PrepareURIPathUseCase.PreparedURIPaths?
|
||||
) throws {
|
||||
@@ -69,7 +69,7 @@ struct PrepareURIPathUseCaseTests {
|
||||
Input.prepareURIPathsSlashed,
|
||||
Output.prepareURIPaths
|
||||
))
|
||||
func dataWithURIRootSuffixedWithForwardSlash(
|
||||
func data_withURIRoot_suffixed_withForwardSlash(
|
||||
uri uriPath: String,
|
||||
expects result: PrepareURIPathUseCase.PreparedURIPaths?
|
||||
) throws {
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
import Hummingbird
|
||||
import Testing
|
||||
|
||||
import protocol Hummingbird.RequestContext
|
||||
|
||||
import struct Hummingbird.HTTPResponse
|
||||
import struct Hummingbird.Request
|
||||
import struct Logging.Logger
|
||||
|
||||
@testable import struct DocCMiddleware.RedirectURIUseCase
|
||||
@@ -24,7 +27,7 @@ struct RedirectURIUseCaseTests {
|
||||
|
||||
#if swift(>=6.2)
|
||||
@Test
|
||||
func `response when logger expects an event`() async throws {
|
||||
func `response when logging event triggered`() async throws {
|
||||
try await assertResponse(
|
||||
logLevel: try randomLogLevelWithEvent,
|
||||
uriRedirection: .Sample.uriRedirection,
|
||||
@@ -33,7 +36,7 @@ struct RedirectURIUseCaseTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
func `response when logger does not expects an event`() async throws {
|
||||
func `response when logging event not triggered`() async throws {
|
||||
try await assertResponse(
|
||||
logLevel: try randomLogLevelWithNoEvent,
|
||||
uriRedirection: .Sample.uriRedirection,
|
||||
@@ -41,8 +44,8 @@ struct RedirectURIUseCaseTests {
|
||||
)
|
||||
}
|
||||
#else
|
||||
@Test("response when logger expects an event")
|
||||
func responseWhenLoggerExpectsEvent() async throws {
|
||||
@Test("response when logging event triggered")
|
||||
func response_whenEventTriggered() async throws {
|
||||
try await assertResponse(
|
||||
logLevel: try randomLogLevelWithEvent,
|
||||
uriRedirection: .uriRedirection,
|
||||
@@ -50,8 +53,8 @@ struct RedirectURIUseCaseTests {
|
||||
)
|
||||
}
|
||||
|
||||
@Test("response when logger does not expects an event")
|
||||
func responseWhenLogLevel() async throws {
|
||||
@Test("response when logging event not triggered")
|
||||
func response_whenEventNotTriggered() async throws {
|
||||
try await assertResponse(
|
||||
logLevel: try randomLogLevelWithNoEvent,
|
||||
uriRedirection: .uriRedirection,
|
||||
@@ -68,8 +71,7 @@ private extension RedirectURIUseCaseTests {
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
/// Asserts the response returned by the ``RedirectURIUseCase`` use case based on the given `logLevel` logging level and the `uriRedirection`
|
||||
/// URI path plus the expected status code of the response.
|
||||
/// Asserts a response returned by the ``RedirectURIUseCase`` use case.
|
||||
/// - Parameters:
|
||||
/// - logLevel: A representation of the logging level to set in the `Logger` instance.
|
||||
/// - uriRedirection: A URI path to use in the redirection.
|
||||
@@ -154,11 +156,11 @@ private extension RedirectURIUseCaseTests {
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
/// Checks whether a logging event should be logged or not, based on a given logging level.
|
||||
/// - Parameter level: A representation of a logging level defined in the `Logger` instance.
|
||||
/// Checks whether a logging event should be logged or not.
|
||||
/// - Parameter logLevel: A representation of a logging level defined in the logger.
|
||||
/// - Returns: A boolean value that indicates whether a logging event should have been logged or not.
|
||||
func shouldEventBeLogged(_ logLevel: Logger.Level) -> Bool {
|
||||
[Logger.Level.trace, .debug].contains(logLevel)
|
||||
[Logger.Level.debug, .trace].contains(logLevel)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ struct DocCMiddlewareTests {
|
||||
}
|
||||
#else
|
||||
@Test("initialize with URI and folder paths")
|
||||
func initWithURIAndFolderPaths() {
|
||||
func init_withURI_andFolderPaths() {
|
||||
assertInit(configuration: .init(
|
||||
uriRoot: "/path/to/documentation",
|
||||
folderRoot: "/location/docc/documentation"
|
||||
@@ -53,7 +53,7 @@ struct DocCMiddlewareTests {
|
||||
}
|
||||
|
||||
@Test("initialize with type that conforms to the FileProvider protocol")
|
||||
func initWithURIPathAndFileProviderType() {
|
||||
func init_withURI_path_andFileProviderType() {
|
||||
assertInit(
|
||||
configuration: .init(
|
||||
uriRoot: "/path/to/documentation",
|
||||
|
||||
Reference in New Issue
Block a user