Skip to content

Commit

Permalink
fix: implement boundaries for all mocked float values (between 0 and 1)
Browse files Browse the repository at this point in the history
See: BEDS-444
  • Loading branch information
LuccaBitfly committed Oct 22, 2024
1 parent 1009dd7 commit 49e6e63
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions backend/pkg/api/data_access/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"time"

"github.com/go-faker/faker/v4"
"github.com/go-faker/faker/v4/pkg/interfaces"
"github.com/go-faker/faker/v4/pkg/options"
"github.com/gobitfly/beaconchain/pkg/api/enums"
"github.com/gobitfly/beaconchain/pkg/api/types"
t "github.com/gobitfly/beaconchain/pkg/api/types"
commontypes "github.com/gobitfly/beaconchain/pkg/commons/types"
"github.com/gobitfly/beaconchain/pkg/userservice"
Expand Down Expand Up @@ -55,7 +55,7 @@ func randomEthDecimal() decimal.Decimal {
// must pass a pointer to the data
func commonFakeData(a interface{}) error {
// TODO fake decimal.Decimal
return faker.FakeData(a, options.WithRandomMapAndSliceMaxSize(5))
return faker.FakeData(a, options.WithRandomMapAndSliceMaxSize(5), options.WithRandomFloatBoundaries(interfaces.RandomFloatBoundary{Start: 0, End: 1}))
}

func (d *DummyService) StartDataAccessServices() {
Expand Down Expand Up @@ -393,7 +393,7 @@ func (d *DummyService) GetValidatorDashboardRocketPoolMinipools(ctx context.Cont
}

func (d *DummyService) GetAllNetworks() ([]t.NetworkInfo, error) {
return []types.NetworkInfo{
return []t.NetworkInfo{
{
ChainId: 1,
Name: "ethereum",
Expand All @@ -412,8 +412,8 @@ func (d *DummyService) GetAllNetworks() ([]t.NetworkInfo, error) {
}, nil
}

func (d *DummyService) GetAllClients() ([]types.ClientInfo, error) {
return []types.ClientInfo{
func (d *DummyService) GetAllClients() ([]t.ClientInfo, error) {
return []t.ClientInfo{
// execution_layer
{
Id: 0,
Expand Down Expand Up @@ -756,8 +756,8 @@ func (d *DummyService) GetValidatorDashboardMobileWidget(ctx context.Context, da
return getDummyStruct[t.MobileWidgetData]()
}

func (d *DummyService) GetUserMachineMetrics(ctx context.Context, userID uint64, limit int, offset int) (*types.MachineMetricsData, error) {
data, err := getDummyStruct[types.MachineMetricsData]()
func (d *DummyService) GetUserMachineMetrics(ctx context.Context, userID uint64, limit int, offset int) (*t.MachineMetricsData, error) {
data, err := getDummyStruct[t.MachineMetricsData]()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 49e6e63

Please sign in to comment.