Dated the demo cons in the Persistence package from the weekend after seeding, and re-dated the ones already seeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javierandClaude Opus 5.5 committed 2026-10-25 12:47:23 +01:00
1 parent e0524da525
commit 3a3d2619ad
6 files changed
+77 -32

No files matched your search

@@ -46,13 +46,13 @@ struct CommunityRepositoryTests {
let clock = Clock()
let collecting = CollectingRepository(fluent: fluent, now: clock.now)
// 22 September 2026: every demo con is still to come.
clock.advance(by: Seed.day(2026, 9, 22).timeIntervalSince(clock.now()))
// The present, which every demo con is seeded after.
clock.advance(by: Date().timeIntervalSince(clock.now()))
let all = try await collecting.upcomingEvents()
// Sunday 27 September, the con's last day: still on. Two weeks later it is over, and so is Stripdagen.
clock.advance(by: 5 * 86_400)
// The first con's last day: still on. Two weeks later it is over, and so is Stripdagen.
clock.advance(by: try #require(all.first).endsOn.timeIntervalSince(clock.now()))
let lastDay = try await collecting.upcomingEvents()
@@ -67,17 +67,35 @@ struct CommunityRepositoryTests {
}
}
@Test
func `dates the demo cons on weekends, from the first one after seeding`() {
var calendar = Calendar(identifier: .gregorian)
calendar.timeZone = TimeZone(identifier: "Europe/Amsterdam") ?? .gmt
// Monday 21 September 2026: the dates the prototype first shipped with.
let days = Seed.events(after: Date(timeIntervalSince1970: 1_790_000_000)).map { entry in
[entry.event.startsOn, entry.event.endsOn]
.map { calendar.dateComponents([.month, .day, .hour], from: $0) }
.map { "\($0.month ?? 0)/\($0.day ?? 0) \($0.hour ?? 0):00" }
}
#expect(days == [
["9/26 12:00", "9/27 12:00"],
["10/3 12:00", "10/4 12:00"],
["11/21 12:00", "11/22 12:00"],
["12/5 12:00", "12/6 12:00"],
])
}
@Test
func `lets a seller pick the events their shop trades at`() async throws {
try await withDatabase { fluent in
let clock = Clock()
let collecting = CollectingRepository(fluent: fluent, now: clock.now)
let collecting = CollectingRepository(fluent: fluent)
let accounts = AccountRepository(fluent: fluent)
let joost = try await accounts.account(email: "joost@kestrelrow.example")
let mara = try await accounts.account(email: "mara.v@example.com")
clock.advance(by: Seed.day(2026, 9, 22).timeIntervalSince(clock.now()))
try await collecting.setEvents(["stripdagen-haarlem", "comic-con-amsterdam", "no-such-event"], forShopOwnedBy: joost)
// An account without a shop changes nothing.
try await collecting.setEvents(["dutch-comic-con"], forShopOwnedBy: mara)