diff --git a/Tests/NodesGeneratorTests/Support/Array.swift b/Tests/NodesGeneratorTests/Support/Array.swift index 7254946c3..1c5c25fcb 100644 --- a/Tests/NodesGeneratorTests/Support/Array.swift +++ b/Tests/NodesGeneratorTests/Support/Array.swift @@ -14,9 +14,16 @@ extension Array where Element == String { internal static func mock(with identifier: String, count: Int) -> Self { guard count > 0 else { return [] } - guard count > 1 - else { return ["<\(identifier)>"] } - return (1...count).map { "<\(identifier)\($0)>" } + return switch count { + case 1: + [ + "<\(identifier)>" + ] + default: + (1...count).map { index in + "<\(identifier)\(index)>" + } + } } } @@ -25,10 +32,21 @@ extension Array where Element == Config.Variable { internal static func mock(with identifier: String, count: Int) -> Self { guard count > 0 else { return [] } - guard count > 1 - else { return [Config.Variable(name: "<\(identifier)Name>", type: "<\(identifier)Type>")] } - return (1...count).map { count in - Config.Variable(name: "<\(identifier)Name\(count)>", type: "<\(identifier)Type\(count)>") + return switch count { + case 1: + [ + Config.Variable( + name: "<\(identifier)Name>", + type: "<\(identifier)Type>" + ) + ] + default: + (1...count).map { index in + Config.Variable( + name: "<\(identifier)Name\(index)>", + type: "<\(identifier)Type\(index)>" + ) + } } } }