Implemented phase 2 for the POC prototype in the Website service.
This commit is contained in:
1 parent
09c7b8a1a7
commit
43dcc03da6
28 files changed
+1468
-65
No files matched your search
@@ -97,6 +97,36 @@ struct AppTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func `sign-in to start a session the other pages recognize`() async throws {
|
||||
try await app(
|
||||
staticFilesPath: staticFilesPath
|
||||
).test(.router) { client in
|
||||
let cookie = try await client.execute(
|
||||
uri: "/sign-in",
|
||||
method: .post,
|
||||
headers: [.contentType: "application/x-www-form-urlencoded"],
|
||||
body: ByteBuffer(string: "return=/listing/nightward-1-cgc-9-8")
|
||||
) { response in
|
||||
#expect(response.status == .seeOther)
|
||||
#expect(response.headers[.location] == "/listing/nightward-1-cgc-9-8")
|
||||
|
||||
return String(try #require(response.headers[.setCookie]).prefix { $0 != ";" })
|
||||
}
|
||||
|
||||
try await client.execute(
|
||||
uri: "/listing/nightward-1-cgc-9-8",
|
||||
method: .get,
|
||||
headers: [.cookie: cookie]
|
||||
) { response in
|
||||
let body = String(buffer: response.body)
|
||||
|
||||
#expect(body.contains(#"aria-label="Account of Mara Visser""#))
|
||||
#expect(body.contains(#"href="/listing/nightward-1-cgc-9-8/offer""#))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func `error page to be served for an unknown listing`() async throws {
|
||||
try await app(
|
||||
|
||||
Reference in new issue
Block a user