Phase 2: rewrite subgraph_test.go with fixtures; add replaceable event tests

This commit is contained in:
Jay
2026-05-22 16:08:37 -04:00
parent 4a0ccb9abb
commit 94cfb35fb2
3 changed files with 82 additions and 94 deletions
+6 -11
View File
@@ -199,22 +199,17 @@ func TestParseEventJSON(t *testing.T) {
// Skip `enforcePolicyRules` -- requires BoltDB
func TestConvertEventsToSubgraphs(t *testing.T) {
fx := LoadFixtures(t)
cases := []struct {
name string
event roots.Event
event roots.ValidatedEvent
wantNodeCount int
wantRelCount int
}{
{
name: "event with no tags",
event: roots.Event{
ID: "abc123",
PubKey: "pubkey1",
CreatedAt: 1000,
Kind: 1,
Content: "test",
Tags: []roots.Tag{},
},
name: "event with no tags",
event: fx.ValidatedEvent(t, "bare"),
wantNodeCount: 2, // event + user
wantRelCount: 1, // signed
},
@@ -232,7 +227,7 @@ func TestConvertEventsToSubgraphs(t *testing.T) {
go convertEventsToSubgraphs(&wg, expanders, inChan, convertedChan)
go func() {
inChan <- EventTraveller{Event: tc.event}
inChan <- EventTraveller{Event: tc.event.Event()}
close(inChan)
}()