Skip to content

Commit

Permalink
Tests fix;
Browse files Browse the repository at this point in the history
  • Loading branch information
mismirnov committed Jan 16, 2025
1 parent 95df86c commit cd39129
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/api/handler/rollup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,13 @@ func (s *RollupTestSuite) TestGetBlobs() {
func (s *RollupTestSuite) TestStats() {
for _, name := range []string{"blobs_count", "size", "size_per_blob", "fee", "tvl"} {
if name != "tvl" {
for _, tf := range []string{"hour", "day", "month"} {
for _, tf := range []storage.Timeframe{storage.TimeframeHour, storage.TimeframeDay, storage.TimeframeMonth} {
req := httptest.NewRequest(http.MethodGet, "/", nil)
rec := httptest.NewRecorder()
c := s.echo.NewContext(req, rec)
c.SetPath("/rollup/:id/stats/:name/:timeframe")
c.SetParamNames("id", "name", "timeframe")
c.SetParamValues("1", name, tf)
c.SetParamValues("1", name, string(tf))

s.rollups.EXPECT().
Series(gomock.Any(), uint64(1), tf, name, storage.NewSeriesRequest(0, 0)).
Expand All @@ -343,13 +343,13 @@ func (s *RollupTestSuite) TestStats() {
s.Require().Len(histogram, 1)
}
} else {
for _, tf := range []string{"day", "month"} {
for _, tf := range []storage.Timeframe{storage.TimeframeDay, storage.TimeframeMonth} {
req := httptest.NewRequest(http.MethodGet, "/", nil)
rec := httptest.NewRecorder()
c := s.echo.NewContext(req, rec)
c.SetPath("/rollup/:id/stats/:name/:timeframe")
c.SetParamNames("id", "name", "timeframe")
c.SetParamValues("1", name, tf)
c.SetParamValues("1", name, string(tf))

s.rollups.EXPECT().
Tvl(gomock.Any(), uint64(1), tf, storage.NewSeriesRequest(0, 0)).
Expand All @@ -376,13 +376,13 @@ func (s *RollupTestSuite) TestStats() {

func (s *RollupTestSuite) TestDistribution() {
for _, name := range []string{"blobs_count", "size", "size_per_blob", "fee_per_blob"} {
for _, tf := range []string{"hour", "day"} {
for _, tf := range []storage.Timeframe{storage.TimeframeHour, storage.TimeframeDay} {
req := httptest.NewRequest(http.MethodGet, "/", nil)
rec := httptest.NewRecorder()
c := s.echo.NewContext(req, rec)
c.SetPath("/rollup/:id/distribution/:name/:timeframe")
c.SetParamNames("id", "name", "timeframe")
c.SetParamValues("1", name, tf)
c.SetParamValues("1", name, string(tf))

s.rollups.EXPECT().
Distribution(gomock.Any(), uint64(1), name, tf).
Expand Down
1 change: 1 addition & 0 deletions cmd/api/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func TestRoutes(t *testing.T) {
"/v1/rollup/group GET": {},
"/v1/blob/proofs POST": {},
"/v1/stats/tvs GET": {},
"/v1/stats/tvs/:timeframe GET": {},
}

ctx, cancel := context.WithCancel(context.Background())
Expand Down

0 comments on commit cd39129

Please sign in to comment.