Refactor event processing in tests for chronological order
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

- Updated test files to collect events first and sort them by their CreatedAt timestamp before processing, ensuring events are handled in chronological order.
- Removed redundant error checks for scanner errors after event processing.
- Enhanced clarity and maintainability of event handling in tests across multiple files, including export, fetch, and query tests.
- Adjusted expected index counts in tests to reflect changes in event structure and processing logic.
This commit is contained in:
2025-10-16 15:05:19 +01:00
parent db941a18ea
commit a4c4f14b87
38 changed files with 400 additions and 238 deletions

View File

@@ -146,23 +146,16 @@ func TestMultipleParameterizedReplaceableEvents(t *testing.T) {
Ids: tag.NewFromBytesSlice(baseEvent.ID),
},
)
if err == nil {
t.Fatalf("found base event by ID: %v", err)
if err != nil {
t.Fatalf("Failed to query for base event by ID: %v", err)
}
// // Verify we can still get the base event when querying by ID
// if len(evs) != 1 {
// t.Fatalf(
// "Expected 1 event when querying for base event by ID, got %d",
// len(evs),
// )
// }
//
// // Verify it's the base event
// if !utils.FastEqual(evs[0].ID, baseEvent.ID) {
// t.Fatalf(
// "Event ID doesn't match when querying for base event by ID. Got %x, expected %x",
// evs[0].ID, baseEvent.ID,
// )
// }
// Verify we get 0 events when querying for the base event by ID
// This is correct behavior for parameterized replaceable events - older events are replaced
if len(evs) != 0 {
t.Fatalf(
"Expected 0 events when querying for replaced base event by ID, got %d",
len(evs),
)
}
}