Skip to content

Commit 0ebaab3

Browse files
committed
Convert SearchShowModelAppTests
1 parent b77ad94 commit 0ebaab3

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

Tests/AppTests/SearchShowModelAppTests.swift

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,28 @@
1616

1717
import Dependencies
1818
import SwiftSoup
19-
import XCTVapor
19+
import Testing
20+
import Vapor
2021

2122

22-
class SearchShowModelAppTests: AppTestCase {
23+
@Suite struct SearchShowModelAppTests {
2324

24-
func test_SearchShow_Model_canonicalURLAllowList() async throws {
25+
@Test func SearchShow_Model_canonicalURLAllowList() async throws {
2526
try await withDependencies {
2627
$0.environment.dbId = { nil }
2728
} operation: {
28-
let request = Vapor.Request(application: app,
29-
url: "search?query=alamo&page=2&utm_campaign=test&utm_source=email",
30-
on: app.eventLoopGroup.next())
31-
let html = try await SearchController.show(req: request).render()
32-
let document = try SwiftSoup.parse(html)
33-
let linkElements = try document.select("link[rel='canonical']")
34-
XCTAssertEqual(linkElements.count, 1)
29+
try await withApp { app in
30+
let request = Vapor.Request(application: app,
31+
url: "search?query=alamo&page=2&utm_campaign=test&utm_source=email",
32+
on: app.eventLoopGroup.next())
33+
let html = try await SearchController.show(req: request).render()
34+
let document = try SwiftSoup.parse(html)
35+
let linkElements = try document.select("link[rel='canonical']")
36+
#expect(linkElements.count == 1)
3537

36-
let href = try linkElements.first()!.attr("href")
37-
XCTAssertEqual(href, "http://localhost:8080/search?query=alamo&page=2")
38+
let href = try linkElements.first()!.attr("href")
39+
#expect(href == "http://localhost:8080/search?query=alamo&page=2")
40+
}
3841
}
3942
}
4043

0 commit comments

Comments
 (0)