Skip to content

Commit

Permalink
semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
muku314115 committed Nov 6, 2023
1 parent a9cec17 commit 98e236b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions testutil/keeper/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ import (
)

// CreateCoordinator creates a coordinator in the store and returns ID with associated address
func (tm TestMsgServers) CreateCoordinator(ctx context.Context, r *rand.Rand, optionalAddress ...string) (id uint64, address sdk.AccAddress) {
var addr sdk.AccAddress
if optionalAddress == nil {
addr = sample.AccAddress(r)
} else {
addr = sdk.MustAccAddressFromBech32(optionalAddress[0])
}
func (tm TestMsgServers) CreateCoordinator(ctx context.Context, r *rand.Rand) (id uint64, address sdk.AccAddress) {
addr := sample.AccAddress(r)
res, err := tm.ProfileSrv.CreateCoordinator(ctx, &profiletypes.MsgCreateCoordinator{
Address: addr.String(),
Description: sample.CoordinatorDescription(r),
})
require.NoError(tm.T, err)
return res.CoordinatorID, addr
}

// CreateCoordinator creates a coordinator in the store and returns ID with associated address
func (tm TestMsgServers) CreateCoordinatorWithAddr(ctx context.Context, r *rand.Rand, address string) (uint64, sdk.AccAddress) {
addr := sdk.MustAccAddressFromBech32(address)
res, err := tm.ProfileSrv.CreateCoordinator(ctx, &profiletypes.MsgCreateCoordinator{
Address: address,
Description: sample.CoordinatorDescription(r),
})
require.NoError(tm.T, err)
return res.CoordinatorID, addr
}
2 changes: 1 addition & 1 deletion x/launch/keeper/msg_create_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestMsgCreateChain(t *testing.T) {
for i := range coordAddrs {
addr := sample.Address(r)
coordAddrs[i] = addr
coordMap[addr], _ = ts.CreateCoordinator(ctx, r, addr)
coordMap[addr], _ = ts.CreateCoordinatorWithAddr(ctx, r, addr)
}

// Create a project for each valid coordinator
Expand Down
2 changes: 1 addition & 1 deletion x/project/keeper/msg_create_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestMsgCreateProject(t *testing.T) {
for i := range coordAddrs {
addr := sample.Address(r)
coordAddrs[i] = addr
coordMap[addr], _ = ts.CreateCoordinator(ctx, r, addr)
coordMap[addr], _ = ts.CreateCoordinatorWithAddr(ctx, r, addr)
}
})

Expand Down

0 comments on commit 98e236b

Please sign in to comment.