BadgeCountTests follows the deposit path wave 2 left behind
ci / checks (pull_request) Successful in 22s
ci / swift (pull_request) Successful in 9m50s
ci / image (pull_request) Successful in 1m56s
ci / deploy (pull_request) Skipped

`Routes.placeDeposits` is gone: wave 2 split it into `resolveDeposits`, which
turns a peer's envelopes into `Delivery.Item`s, and `Delivery.write`, which
inserts them and then wakes and pushes. The test still called the old one and
the Linux test build stopped on "type 'Routes' has no member 'placeDeposits'".

It now does what the route does, in the same two steps, and still asserts the
same thing: a deposit is written with `announced` false, so the badge does not
count it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-10-14 12:47:33 -04:00
co-authored by Claude Opus 5
parent ba68984eab
commit dca5333e9b
+18 -7
View File
@@ -127,13 +127,24 @@ struct BadgeCountTests {
user.fnid = "fnid:bob"
try await user.create(on: h.db)
let placed = try await Routes.placeDeposits(
[
FederationDepositRequest.Item(
to_fnid: "fnid:bob", to_device: r.deviceID, payload: "afar",
envelope_id: nil)
], on: h.db)
#expect(placed.accepted == 1)
// The route's own two steps since wave 2: `resolveDeposits` turns
// a peer's envelopes into `Delivery.Item`s, and `Delivery.write`
// inserts them. It used to be one `placeDeposits` call that did
// both. The point of the test is unchanged: a deposit is written
// with `announced` false, so the badge does not count it.
let (ids, unknown) = try await Delivery.write(
db: h.db, app: h.app
) { db in
let resolved = try await Routes.resolveDeposits(
[
FederationDepositRequest.Item(
to_fnid: "fnid:bob", to_device: r.deviceID, payload: "afar",
envelope_id: nil)
], on: db)
return (resolved.items, resolved.unknown)
}
#expect(ids.count == 1)
#expect(unknown.isEmpty)
#expect(try await badge(h, r) == 0)
}
}