mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-22 21:11:26 +00:00
test(channels): preserve the existing catch-up response shape
This commit is contained in:
1 parent
07335e6625
commit
8f6032877b
1 file changed
+14
-6
@@ -137,13 +137,21 @@ SELECT packet_hash,md5(n::text)::uuid,'YOW',NOW(),0,1,0 FROM packets CROSS JOIN
|
||||
if response.Code != 200 {
|
||||
t.Fatalf("%s: %d %s", path, response.Code, response.Body.String())
|
||||
}
|
||||
var body struct {
|
||||
Items []api.ChannelMessage `json:"items"`
|
||||
if path == "/messages/backfill?afterId=0" {
|
||||
var items []api.ChannelMessage
|
||||
if err := json.Unmarshal(response.Body.Bytes(), &items); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check(items)
|
||||
} else {
|
||||
var body struct {
|
||||
Items []api.ChannelMessage `json:"items"`
|
||||
}
|
||||
if err := json.Unmarshal(response.Body.Bytes(), &body); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check(body.Items)
|
||||
}
|
||||
if err := json.Unmarshal(response.Body.Bytes(), &body); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check(body.Items)
|
||||
}
|
||||
filtered, err := s.ListChannelMessages(ctx, &ch, time.Time{}, 20, []string{"YOW"}, "#yow", 0)
|
||||
if err != nil || len(filtered.Items) != 1 || filtered.Items[0].Scope == nil || *filtered.Items[0].Scope != "#yow" {
|
||||
|
||||
Reference in new issue
Block a user