Refactor event processing in tests for chronological order
- 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:
@@ -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),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user