Implemented phase 5 for the POC prototype in the Website service.

This commit is contained in:
javier committed 2026-09-21 13:32:05 +02:00
1 parent 89a7a7b8e5
commit 31d2d98d49
46 files changed
+4039 -162

No files matched your search

@@ -40,11 +40,11 @@ struct CatalogueComponentsTests {
// MARK: ListingCard tests
@Test
func `links a card to its listing and gates saving behind the sign-in`() {
func `links a card to its listing, and saving it to a want for it`() {
let html = ListingCard(.stub()).render()
#expect(html.contains(#"href="/listing/nightward-1">Nightward #1</a>"#))
#expect(html.contains(#"href="/sign-in?return=/listing/nightward-1""#))
#expect(html.contains(#"href="/wants/new?listing=nightward-1""#))
#expect(html.contains("€240"))
#expect(html.contains("CGC 9.8"))
}
@@ -19,7 +19,7 @@ struct SiteFooterTests {
#expect(html.contains(">\(title)</h2>"))
}
for path in [String.Route.series, .Route.openShop, .Route.gradingGuide, .Route.signIn, .Route.recover, .Route.terms] {
for path in [String.Route.series, .Route.openShop, .Route.gradingGuide, .Route.signIn, .Route.wants, .Route.account] {
#expect(html.contains(#"href="\#(path)""#))
}
}
@@ -35,13 +35,23 @@ struct SiteHeaderTests {
#expect(html.contains(#"href="/sell""#))
#expect(html.contains(">MV<"))
#expect(html.contains(">Mara<"))
#expect(html.contains(#"action="/sign-out" method="post""#))
// Signing out lives on the account screen.
#expect(!html.contains("/sign-out"))
#expect(!html.contains(#"href="/sign-in""#))
}
@Test
func `links the shop of a seller alone`() {
#expect(!SiteHeader(viewer: .init(displayName: "Mara")).render().contains(#"href="/sell""#))
func `leads a seller to their shop, and anyone else to opening one`() {
let buyer = SiteHeader(viewer: .init(displayName: "Mara")).render()
#expect(!buyer.contains(#"href="/sell""#))
#expect(buyer.contains(#"href="/sell/open-a-shop""#))
#expect(buyer.contains(">Open a shop<"))
}
@Test
func `counts one new match in the singular`() {
#expect(SiteHeader(viewer: .init(displayName: "Mara", newWantMatches: 1)).render().contains(#"aria-label="Want list, 1 new match""#))
}
@Test