From 4f84495b6e585cb8a3ffe46b05c8d356b0b8cc86 Mon Sep 17 00:00:00 2001 From: muku314115 Date: Mon, 6 Nov 2023 13:38:34 +0530 Subject: [PATCH] extending --- x/launch/keeper/msg_edit_chain_test.go | 39 ++++++++++--------- .../msg_update_launch_information_test.go | 14 ++----- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/x/launch/keeper/msg_edit_chain_test.go b/x/launch/keeper/msg_edit_chain_test.go index bbeae4270..2f87718cb 100644 --- a/x/launch/keeper/msg_edit_chain_test.go +++ b/x/launch/keeper/msg_edit_chain_test.go @@ -24,36 +24,39 @@ func TestMsgEditChain(t *testing.T) { ) // Create coordinators - _, coordAddress := ts.CreateCoordinator(ctx, r) - _, coordAddress2 := ts.CreateCoordinator(ctx, r) + _, coordAddr := ts.CreateCoordinator(ctx, r) + _, coordAddr2 := ts.CreateCoordinator(ctx, r) + + coordAddress := coordAddr.String() + coordAddress2 := coordAddr2.String() // Create a chain - launchID := ts.CreateChain(ctx, r, coordAddress.String(), "", false, 0) + launchID := ts.CreateChain(ctx, r, coordAddress, "", false, 0) // create a project - projectID := ts.CreateProject(ctx, r, coordAddress.String()) + projectID := ts.CreateProject(ctx, r, coordAddress) // create a chain with an existing project - launchIDHasProject := ts.CreateChain(ctx, r, coordAddress.String(), "", true, projectID) + launchIDHasProject := ts.CreateChain(ctx, r, coordAddress, "", true, projectID) // create a project - validProjectID := ts.CreateProject(ctx, r, coordAddress.String()) + validProjectID := ts.CreateProject(ctx, r, coordAddress) // create a project from a different address - projectDifferentCoordinator := ts.CreateProject(ctx, r, coordAddress2.String()) + projectDifferentCoordinator := ts.CreateProject(ctx, r, coordAddress2) // Create a new chain for more tests - launchID2 := ts.CreateChain(ctx, r, coordAddress.String(), "", false, 0) + launchID2 := ts.CreateChain(ctx, r, coordAddress, "", false, 0) // create a new project and add a chainProjects entry to it - projectDuplicateChain := ts.CreateProject(ctx, r, coordAddress.String()) + projectDuplicateChain := ts.CreateProject(ctx, r, coordAddress) err := tk.ProjectKeeper.AddChainToProject(sdkCtx, projectDuplicateChain, launchID2) require.NoError(t, err) // create message with an invalid metadata length msgEditChainInvalidMetadata := sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchID, true, validProjectID, @@ -70,7 +73,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should allow setting a project ID", msg: sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchID, true, validProjectID, @@ -80,7 +83,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should allow editing metadata", msg: sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchID, false, 0, @@ -90,7 +93,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should prevent editing chain from non existent launch id", msg: sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchIDNoExist, true, 0, @@ -112,7 +115,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should prevent editing chain with invalid coordinator", msg: sample.MsgEditChain(r, - coordAddress2.String(), + coordAddress2, launchID, true, 0, @@ -123,7 +126,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should prevent setting project id for chain with a project", msg: sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchIDHasProject, true, 0, @@ -134,7 +137,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should prevent setting project id where project does not exist", msg: sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchID2, true, 999, @@ -145,7 +148,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should prevent setting project id where project has a different coordinator", msg: sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchID2, true, projectDifferentCoordinator, @@ -156,7 +159,7 @@ func TestMsgEditChain(t *testing.T) { { name: "should prevent setting project id where project chain entry is duplicated", msg: sample.MsgEditChain(r, - coordAddress.String(), + coordAddress, launchID2, true, projectDuplicateChain, diff --git a/x/launch/keeper/msg_update_launch_information_test.go b/x/launch/keeper/msg_update_launch_information_test.go index 413d5ebeb..baed2e14a 100644 --- a/x/launch/keeper/msg_update_launch_information_test.go +++ b/x/launch/keeper/msg_update_launch_information_test.go @@ -15,21 +15,15 @@ import ( func TestMsgUpdateLaunchInformation(t *testing.T) { sdkCtx, tk, ts := testkeeper.NewTestSetup(t) ctx := sdk.WrapSDKContext(sdkCtx) - coordAddress := sample.Address(r) - coordAddress2 := sample.Address(r) coordNoExist := sample.Address(r) launchIDNoExist := uint64(1000) // Create coordinators - msgCreateCoordinator := sample.MsgCreateCoordinator(coordAddress) - resCoord, err := ts.ProfileSrv.CreateCoordinator(ctx, &msgCreateCoordinator) - require.NoError(t, err) + coordID, coordAddr := ts.CreateCoordinator(ctx, r) + coordAddress := coordAddr.String() - coordID := resCoord.CoordinatorID - - msgCreateCoordinator = sample.MsgCreateCoordinator(coordAddress2) - _, err = ts.ProfileSrv.CreateCoordinator(ctx, &msgCreateCoordinator) - require.NoError(t, err) + _, coordAddr2 := ts.CreateCoordinator(ctx, r) + coordAddress2 := coordAddr2.String() // Create a chain launchID := uint64(1)