Skip to content

Commit

Permalink
Merge pull request #456 from JPToroDev/012925a
Browse files Browse the repository at this point in the history
Fix SwiftLint errors. Clean up tests.
  • Loading branch information
JPToroDev authored Feb 1, 2025
2 parents caac7c5 + c1323ed commit 07cb7d9
Show file tree
Hide file tree
Showing 18 changed files with 181 additions and 321 deletions.
2 changes: 1 addition & 1 deletion Tests/IgniteTesting/Elements/Code.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Testing
@Suite("Code Tests")
@MainActor
struct CodeTests {
@Test("Test inline code formatting")
@Test("Inline code formatting")
func inlineCode() async throws {
let element = Code("background-color")
let output = element.render()
Expand Down
2 changes: 1 addition & 1 deletion Tests/IgniteTesting/Elements/CodeBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Testing
@Suite("CodeBlock Tests")
@MainActor
struct CodeBlockTests {
@Test("Test rendering a code block")
@Test("Rendering a code block")
func codeBlockTest() {
let element = CodeBlock {
"""
Expand Down
2 changes: 1 addition & 1 deletion Tests/IgniteTesting/Elements/Divider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Testing
@Suite("Divider Tests")
@MainActor
struct DividerTests {
@Test("Test a single divider")
@Test("A single divider")
func singleDivider() async throws {
let element = Divider()
let output = element.render()
Expand Down
8 changes: 4 additions & 4 deletions Tests/IgniteTesting/Elements/MetaLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import Testing
@Suite("MetaLink Tests")
@MainActor
struct MetaLinkTests {
@Test("Test with href string and rel string")
@Test("href string and rel string")
func hrefStringAndRelString() async throws {
let element = MetaLink(href: "https://www.example.com", rel: "canonical")
let output = element.render()

#expect(output == "<link href=\"https://www.example.com\" rel=\"canonical\" />")
}

@Test("Test href URL and rel string")
@Test("href URL and rel string")
func hrefURLAndRelString() async throws {
let url = try #require(URL(string: "https://www.example.com"))
let element = MetaLink(href: url, rel: "canonical")
Expand All @@ -31,15 +31,15 @@ struct MetaLinkTests {
#expect(output == "<link href=\"https://www.example.com\" rel=\"canonical\" />")
}

@Test("Test href string and rel Link.Relationship")
@Test("href string and rel Link.Relationship")
func hrefStringAndRelRelationship() async throws {
let element = MetaLink(href: "https://www.example.com", rel: .external)
let output = element.render()

#expect(output == "<link href=\"https://www.example.com\" rel=\"external\" />")
}

@Test("Test href URL and rel Link.Relationship")
@Test("href URL and rel Link.Relationship")
func hrefURLAndRelRelationship() async throws {
let url = try #require(URL(string: "https://www.example.com"))
let element = MetaLink(href: url, rel: .alternate)
Expand Down
14 changes: 7 additions & 7 deletions Tests/IgniteTesting/Extensions/Array-LocalizedContains.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Testing
@Suite("Array-LocalizedContains Tests")
@MainActor
struct ArrayLocalizedContainsTests {
@Test("Test case when array contains a matching string")
@Test("Array contains a matching string")
func arrayContainsMatchingString() async throws {
// Given
let testArray = ["Tom", "Jerry", "Nibbles", "Butch"]
Expand All @@ -34,7 +34,7 @@ struct ArrayLocalizedContainsTests {
#expect(result4 == true)
}

@Test("Test case when array does NOT contain a matching string")
@Test("Array does NOT contain a matching string")
func arrayDoesNotContainMatchingString() async throws {
// Given
let testArray = ["Tom", "Jerry", "Nibbles", "Butch"]
Expand All @@ -54,7 +54,7 @@ struct ArrayLocalizedContainsTests {
#expect(result4 == false)
}

@Test("Test case for strings with diacritics")
@Test("Strings with diacritics")
func arrayContainsStringsWithDiacritics() async throws {
// Given
let testArray = ["über", "jalapeño", "façade", "naïve"]
Expand All @@ -69,7 +69,7 @@ struct ArrayLocalizedContainsTests {
#expect(actualCount == expectedCount)
}

@Test("Test case for strings with currently unsupported diacritics")
@Test("Strings with currently unsupported diacritics")
func arrayContainsUnsupportedDiacritics() async throws {
// Given
let testArray = ["łódź", "følg", "zażółć"]
Expand All @@ -83,7 +83,7 @@ struct ArrayLocalizedContainsTests {
#expect(actualCount == 0)
}

@Test("Test case for strings with special characters")
@Test("Strings with special characters")
func arrayContainsSpecialCharacters() async throws {
// Given
let testArray = ["!@#$%^", "&*()_+", "-=~`|", "{[}]\\", ":;\"'<", ">?/.,"]
Expand All @@ -98,7 +98,7 @@ struct ArrayLocalizedContainsTests {
#expect(actualCount == expectedCount)
}

@Test("Test case for an empty string")
@Test("Empty string")
func usingLocalizedContains_forAnEmptyString() async throws {
// Given
let testArray = [" ", "", "", "empty"]
Expand All @@ -109,7 +109,7 @@ struct ArrayLocalizedContainsTests {
#expect(result == false)
}

@Test("Test case when array is empty")
@Test("Array is empty")
func callingLocalizedContains_onAnEmptyArray() async throws {
// Given
let testArray = [String]()
Expand Down
2 changes: 1 addition & 1 deletion Tests/IgniteTesting/Extensions/Date-ISO8601.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct DateISO8601Tests {
let expected: String
}

@Test("Test Against Known Output", arguments: [
@Test("Known Output", arguments: [
Instance(input: Date(timeIntervalSince1970: -40241318220), expected: "0694-10-18T00:03:00Z"),
Instance(input: Date(timeIntervalSince1970: 36571335925), expected: "3128-11-25T08:25:25Z"),
Instance(input: Date(timeIntervalSince1970: 18980973526), expected: "2571-06-26T04:38:46Z"),
Expand Down
10 changes: 5 additions & 5 deletions Tests/IgniteTesting/Extensions/Date-RFC822.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct DateRFC822Tests {
let expected: String
}

@Test("Test Against Known Output for Greenwich Mean Time", arguments: [
@Test("Known Output for Greenwich Mean Time", arguments: [
Instance(input: Date(timeIntervalSince1970: 20012346618.957466), expected: "Fri, 02 Mar 2604 09:10:18 +0000"),
Instance(input: Date(timeIntervalSince1970: 56076958399.89086), expected: "Tue, 03 Jan 3747 20:53:19 +0000"),
Instance(input: Date(timeIntervalSince1970: 43889947931.30432), expected: "Sat, 25 Oct 3360 12:12:11 +0000"),
Expand All @@ -43,7 +43,7 @@ struct DateRFC822Tests {
#expect(instance.input.asRFC822(timeZone: timezone) == instance.expected)
}

@Test("Test Against Known Output for New York Time", arguments: [
@Test("Known Output for New York Time", arguments: [
Instance(input: Date(timeIntervalSince1970: 20012346618.957466), expected: "Fri, 02 Mar 2604 04:10:18 -0500"),
Instance(input: Date(timeIntervalSince1970: 56076958399.89086), expected: "Tue, 03 Jan 3747 15:53:19 -0500"),
Instance(input: Date(timeIntervalSince1970: 43889947931.30432), expected: "Sat, 25 Oct 3360 08:12:11 -0400"),
Expand All @@ -63,7 +63,7 @@ struct DateRFC822Tests {
#expect(instance.input.asRFC822(timeZone: timezone) == instance.expected)
}

@Test("Test Against Known Output for America/St Johns Time", arguments: [
@Test("Known Output for America/St Johns Time", arguments: [
Instance(input: Date(timeIntervalSince1970: 20012346618.957466), expected: "Fri, 02 Mar 2604 05:40:18 -0330"),
Instance(input: Date(timeIntervalSince1970: 56076958399.89086), expected: "Tue, 03 Jan 3747 17:23:19 -0330"),
Instance(input: Date(timeIntervalSince1970: 43889947931.30432), expected: "Sat, 25 Oct 3360 09:42:11 -0230"),
Expand All @@ -84,7 +84,7 @@ struct DateRFC822Tests {
#expect(instance.input.asRFC822(timeZone: timezone) == instance.expected)
}

@Test("Test Against Known Output for Asia/Jakarta Time", arguments: [
@Test("Known Output for Asia/Jakarta Time", arguments: [
Instance(input: Date(timeIntervalSince1970: 20012346618.957466), expected: "Fri, 02 Mar 2604 16:10:18 +0700"),
Instance(input: Date(timeIntervalSince1970: 56076958399.89086), expected: "Wed, 04 Jan 3747 03:53:19 +0700"),
Instance(input: Date(timeIntervalSince1970: 43889947931.30432), expected: "Sat, 25 Oct 3360 19:12:11 +0700"),
Expand All @@ -105,7 +105,7 @@ struct DateRFC822Tests {
#expect(instance.input.asRFC822(timeZone: timezone) == instance.expected)
}

@Test("Test Against Known Output for Asia/Kolkata Time", arguments: [
@Test("Known Output for Asia/Kolkata Time", arguments: [
Instance(input: Date(timeIntervalSince1970: 20012346618.957466), expected: "Fri, 02 Mar 2604 14:40:18 +0530"),
Instance(input: Date(timeIntervalSince1970: 56076958399.89086), expected: "Wed, 04 Jan 3747 02:23:19 +0530"),
Instance(input: Date(timeIntervalSince1970: 43889947931.30432), expected: "Sat, 25 Oct 3360 17:42:11 +0530"),
Expand Down
4 changes: 2 additions & 2 deletions Tests/IgniteTesting/Extensions/String-Slug.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ struct StringSlugTests {
#expect(instance.input.convertedToSlug() == instance.expected)
}

@Test("Test Against URL Strings", arguments: [
@Test("URL Strings", arguments: [
Instance(input: "https://github.com/twostraws/Ignite", expected: "https-github-com-twostraws--ignite"),
Instance(input: "https://github.com/twostraws/Ignite/", expected: "https-github-com-twostraws--ignite"),
Instance(input: "file:/Users/george/Documents", expected: "file--users-george--documents")
Expand All @@ -215,7 +215,7 @@ struct StringSlugTests {
#expect(instance.input.convertedToSlug() == instance.expected)
}

@Test("Test Against paths", arguments: [
@Test("Paths", arguments: [
Instance(input: "/Users/george/Documents", expected: "-users-george--documents"),
Instance(input: "/twostraws/Ignite", expected: "twostraws--ignite"),
Instance(input: "~/Documents", expected: "-documents"),
Expand Down
14 changes: 7 additions & 7 deletions Tests/IgniteTesting/Extensions/URL-RemovingWWW.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Testing
@Suite("URL-RemovingWWW Tests")
@MainActor
struct URLRemovingWWWTests {
@Test("Test case when URL contains 'www'")
@Test("URL contains 'www'")
func removingWWW_fromURLWithWWW() async throws {
// Given
let url = URL(string: "https://www.example.com")!
Expand All @@ -24,7 +24,7 @@ struct URLRemovingWWWTests {
#expect(result == "example.com")
}

@Test("Test case when URL does NOT contain 'www")
@Test("URL does NOT contain 'www")
func removingWWW_fromURLWithoutWWW() async throws {
// Given
let url = URL(string: "https://example.com")!
Expand All @@ -34,7 +34,7 @@ struct URLRemovingWWWTests {
#expect(result == "example.com")
}

@Test("Test case when URL contains 'www' in the subdomain")
@Test("URL contains 'www' in the subdomain")
func removingWWW_fromURLWithSubdomain() async throws {
// Given
let url1 = URL(string: "https://www.blog.example.com")!
Expand All @@ -47,7 +47,7 @@ struct URLRemovingWWWTests {
#expect(result2 == "longersubdomain.blog.example.com")
}

@Test("Test case when URL contains 'www' and also contains a path")
@Test("URL contains 'www' and also contains a path")
func removingWWW_fromURLWithPath() async throws {
// Given
let url = URL(string: "https://www.example.com/path/to/resource")!
Expand All @@ -57,7 +57,7 @@ struct URLRemovingWWWTests {
#expect(result == "example.com") // ignores path
}

@Test("Test case when URL has an invalid scheme")
@Test("URL has an invalid scheme")
func removingWWW_fromURLWithInvalidScheme() async throws {
// Given
let url = URL(string: "htp://www.example.com")! // host extraction will succeed
Expand All @@ -67,7 +67,7 @@ struct URLRemovingWWWTests {
#expect(result == "example.com")
}

@Test("Test case when URL contains www in domain or subdomain")
@Test(" URL contains www in domain or subdomain")
func removingWWW_fromURLWithWWWInDomainOrSubdomain() async throws {
// Given
let url1 = URL(string: "https://wwwmywww.example.com")!
Expand All @@ -83,7 +83,7 @@ struct URLRemovingWWWTests {
#expect(result3 == "www.com")
}

@Test("Test case when URL contains an empty host")
@Test("URL contains an empty host")
func removingWWW_fromURLWithEmptyHost() async throws {
// Given
let url = URL(string: "https://www.")!
Expand Down
16 changes: 8 additions & 8 deletions Tests/IgniteTesting/Modifiers/MediaQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct MediaQueryTests {

typealias MediaQueryTestCase = (query: MediaQuery, output: String)

@Test("Test breakpoint queries", arguments: [
@Test("Breakpoint queries", arguments: [
(query: MediaQuery.breakpoint(.small),
output: "min-width: 576px"),
(query: MediaQuery.breakpoint(.medium),
Expand All @@ -38,7 +38,7 @@ struct MediaQueryTests {
)
}

@Test("Test color scheme queries", arguments: [
@Test("Color scheme queries", arguments: [
(query: MediaQuery.colorScheme(.light),
output: "prefers-color-scheme: light"),
(query: MediaQuery.colorScheme(.dark),
Expand All @@ -53,7 +53,7 @@ struct MediaQueryTests {
)
}

@Test("Test contrast queries", arguments: [
@Test("Contrast queries", arguments: [
(query: MediaQuery.contrast(.high),
output: "prefers-contrast: more"),
(query: MediaQuery.contrast(.low),
Expand All @@ -72,7 +72,7 @@ struct MediaQueryTests {
)
}

@Test("Test display mode queries", arguments: [
@Test("Display mode queries", arguments: [
(query: MediaQuery.displayMode(.fullscreen),
output: "display-mode: fullscreen"),
(query: MediaQuery.displayMode(.browser),
Expand All @@ -95,7 +95,7 @@ struct MediaQueryTests {
)
}

@Test("Test orientation queries", arguments: [
@Test("Orientation queries", arguments: [
(query: MediaQuery.orientation(.landscape),
output: "orientation: landscape"),
(query: MediaQuery.orientation(.portrait),
Expand All @@ -110,7 +110,7 @@ struct MediaQueryTests {
)
}

@Test("Test transparency queries", arguments: [
@Test("Transparency queries", arguments: [
(query: MediaQuery.transparency(.normal),
output: "prefers-reduced-transparency: no-preference"),
(query: MediaQuery.transparency(.reduced),
Expand All @@ -123,7 +123,7 @@ struct MediaQueryTests {
#expect(output == testCase.output)
}

@Test("Test reduced motion queries", arguments: [
@Test("Reduced motion queries", arguments: [
(query: MediaQuery.motion(.reduced),
output: "prefers-reduced-motion: reduce"),
(query: MediaQuery.motion(.allowed),
Expand All @@ -138,7 +138,7 @@ struct MediaQueryTests {
)
}

@Test("Test theme queries", arguments: [
@Test("Theme queries", arguments: [
(query: MediaQuery.theme("dark"),
output: "data-theme-state=\"dark\""),
(query: MediaQuery.theme("light"),
Expand Down
2 changes: 1 addition & 1 deletion Tests/IgniteTesting/Publishing/FeedGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct FeedGeneratorTests {
TestSite(timeZone: .init(abbreviation: "EST")!)
]

@Test("Test generateFeed", arguments: await sites)
@Test("generateFeed()", arguments: await sites)
func generateFeed(for site: any Site) async throws {
let feedHref = site.url.appending(path: site.feedConfiguration.path).absoluteString
var exampleContent = Content()
Expand Down
Loading

0 comments on commit 07cb7d9

Please sign in to comment.