diff --git a/internal/actionsdb/events_test.go b/internal/actionsdb/events_test.go index c40f33b..025b7e1 100644 --- a/internal/actionsdb/events_test.go +++ b/internal/actionsdb/events_test.go @@ -31,7 +31,7 @@ func TestEventsList_Success(t *testing.T) { Count: 10, }, 9, - 1, 9, + 9, 1, }, { "count", @@ -40,7 +40,7 @@ func TestEventsList_Success(t *testing.T) { Count: 5, }, 5, - 1, 5, + 9, 5, }, { "after", @@ -50,7 +50,7 @@ func TestEventsList_Success(t *testing.T) { After: 4, }, 5, - 5, 9, + 9, 5, }, { "before", @@ -60,7 +60,7 @@ func TestEventsList_Success(t *testing.T) { Before: 9, }, 5, - 4, 8, + 8, 4, }, { "reverse", @@ -71,7 +71,7 @@ func TestEventsList_Success(t *testing.T) { Reverse: true, }, 5, - 8, 4, + 4, 8, }, } diff --git a/internal/database/events_test.go b/internal/database/events_test.go index 85f901e..a59057b 100644 --- a/internal/database/events_test.go +++ b/internal/database/events_test.go @@ -68,8 +68,8 @@ func TestEventsListByPayloadID_Success(t *testing.T) { l, err := db.EventsListByPayloadID(1) assert.NoError(t, err) require.Len(t, l, 9) - assert.EqualValues(t, l[0].ID, 1) - assert.EqualValues(t, l[len(l)-1].ID, 9) + assert.EqualValues(t, l[0].ID, 9) + assert.EqualValues(t, l[len(l)-1].ID, 1) l, err = db.EventsListByPayloadID(1, database.EventsPagination(database.Page{ @@ -80,8 +80,8 @@ func TestEventsListByPayloadID_Success(t *testing.T) { // Count assert.NoError(t, err) require.Len(t, l, 3) - assert.EqualValues(t, l[0].ID, 1) - assert.EqualValues(t, l[len(l)-1].ID, 3) + assert.EqualValues(t, l[0].ID, 9) + assert.EqualValues(t, l[len(l)-1].ID, 7) // Before l, err = db.EventsListByPayloadID(1, @@ -92,8 +92,8 @@ func TestEventsListByPayloadID_Success(t *testing.T) { ) assert.NoError(t, err) require.Len(t, l, 5) - assert.EqualValues(t, l[0].ID, 2) - assert.EqualValues(t, l[len(l)-1].ID, 6) + assert.EqualValues(t, l[0].ID, 6) + assert.EqualValues(t, l[len(l)-1].ID, 2) // After l, err = db.EventsListByPayloadID(1, @@ -104,8 +104,8 @@ func TestEventsListByPayloadID_Success(t *testing.T) { ) assert.NoError(t, err) require.Len(t, l, 2) - assert.EqualValues(t, l[0].ID, 8) - assert.EqualValues(t, l[len(l)-1].ID, 9) + assert.EqualValues(t, l[0].ID, 9) + assert.EqualValues(t, l[len(l)-1].ID, 8) // Reverse l, err = db.EventsListByPayloadID(1, @@ -117,8 +117,8 @@ func TestEventsListByPayloadID_Success(t *testing.T) { ) assert.NoError(t, err) require.Len(t, l, 2) - assert.EqualValues(t, l[0].ID, 9) - assert.EqualValues(t, l[len(l)-1].ID, 8) + assert.EqualValues(t, l[0].ID, 8) + assert.EqualValues(t, l[len(l)-1].ID, 9) } func TestEventsGetByPayloadAndIndex_Success(t *testing.T) { diff --git a/internal/modules/api/api_test.go b/internal/modules/api/api_test.go index 99956b9..cef06c9 100644 --- a/internal/modules/api/api_test.go +++ b/internal/modules/api/api_test.go @@ -546,8 +546,8 @@ func TestAPI(t *testing.T) { schema: (actions.EventsListResult)(nil), result: map[string]matcher{ "$": length(9), - "$[0].protocol": equal("dns"), - "$[1].protocol": equal("http"), + "$[0].protocol": equal("http"), + "$[8].protocol": equal("dns"), }, status: 200, }, diff --git a/internal/modules/api/apiclient/client_test.go b/internal/modules/api/apiclient/client_test.go index ec37bde..43a63f4 100644 --- a/internal/modules/api/apiclient/client_test.go +++ b/internal/modules/api/apiclient/client_test.go @@ -348,8 +348,8 @@ func TestClient(t *testing.T) { PayloadName: "payload1", }, map[string]matcher{ - "0.Protocol": equal("dns"), - "1.Protocol": equal("http"), + "0.Protocol": equal("http"), + "8.Protocol": equal("dns"), }, nil, },