aboutsummaryrefslogtreecommitdiff
path: root/internal/ingest/client_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ingest/client_test.go')
-rw-r--r--internal/ingest/client_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/ingest/client_test.go b/internal/ingest/client_test.go
index ff80225..50595ec 100644
--- a/internal/ingest/client_test.go
+++ b/internal/ingest/client_test.go
@@ -11,14 +11,16 @@ func TestDecodeExportBody_IgnoresTrailingPartialNDJSONLine(t *testing.T) {
`{"seq":2,"did":"did:plc:bob","cid":"cid2","operation":{"x":2}}`,
`{"seq":3,"did":"did:plc:carol","cid":"cid3","operation":{"x":3}`,
}, "\n")
-
records, err := decodeExportBody(strings.NewReader(body), 0)
+
if err != nil {
t.Fatalf("decode export body: %v", err)
}
+
if len(records) != 2 {
t.Fatalf("record count mismatch: got %d want 2", len(records))
}
+
if records[0].Seq != 1 || records[1].Seq != 2 {
t.Fatalf("unexpected sequences: got [%d %d], want [1 2]", records[0].Seq, records[1].Seq)
}
@@ -30,8 +32,8 @@ func TestDecodeExportBody_FailsOnMalformedNonTrailingNDJSONLine(t *testing.T) {
`{"seq":2,"did":"did:plc:bob","cid":"cid2","operation":{"x":2}`,
`{"seq":3,"did":"did:plc:carol","cid":"cid3","operation":{"x":3}}`,
}, "\n")
-
_, err := decodeExportBody(strings.NewReader(body), 0)
+
if err == nil {
t.Fatalf("expected malformed middle line to fail")
}