Skip to content

Commit

Permalink
test: adjust tests to new offset encoded page_token
Browse files Browse the repository at this point in the history
  • Loading branch information
BarcoMasile committed May 24, 2024
1 parent 92b24d5 commit 903939f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/rules/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func TestHandleListSuccess(t *testing.T) {
},
}

var page int64 = 1
var offset int64 = 0
var size int64 = 100

mockService.EXPECT().ListRules(gomock.Any(), page, size).Return(serviceOutput, nil)
mockService.EXPECT().ListRules(gomock.Any(), offset, size).Return(serviceOutput, nil)

req := httptest.NewRequest(http.MethodGet, "/api/v0/rules?page=1&size=100", nil)
req := httptest.NewRequest(http.MethodGet, "/api/v0/rules?page_token=eyJvZmZzZXQiOjB9&size=100", nil)
w := httptest.NewRecorder()
mux := chi.NewMux()
NewAPI(mockService, mockLogger).RegisterEndpoints(mux)
Expand Down Expand Up @@ -130,10 +130,10 @@ func TestHandleListFailed(t *testing.T) {
mockLogger := NewMockLoggerInterface(ctrl)
mockService := NewMockServiceInterface(ctrl)

var page int64 = 1
var offset int64 = 0
var size int64 = 100

mockService.EXPECT().ListRules(gomock.Any(), page, size).Return(nil, fmt.Errorf("mock_error"))
mockService.EXPECT().ListRules(gomock.Any(), offset, size).Return(nil, fmt.Errorf("mock_error"))

req := httptest.NewRequest(http.MethodGet, "/api/v0/rules?page=0&offset=100", nil)
w := httptest.NewRecorder()
Expand Down

0 comments on commit 903939f

Please sign in to comment.