Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
fix cli test
Browse files Browse the repository at this point in the history
  • Loading branch information
taryune committed Oct 17, 2023
1 parent 5bd2490 commit 4524aa3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions x/registry/client/cli/query_second_level_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// Prevent strconv unused error
var _ = strconv.IntSize

func networkWithSecondLevelDomainObjects(t *testing.T, n int) (*network.Network, []types.SecondLevelDomain) {
func networkWithSecondLevelDomainObjects(t *testing.T, n int) (*network.Network, []types.SecondLevelDomainResponse) {
t.Helper()
cfg := network.DefaultConfig()
state := types.GenesisState{}
Expand All @@ -31,9 +31,7 @@ func networkWithSecondLevelDomainObjects(t *testing.T, n int) (*network.Network,
secondLevelDomain := types.SecondLevelDomain{
Name: strconv.Itoa(i),
Parent: strconv.Itoa(i),
DnsRecords: make(map[string]*types.DnsRecord),
WalletRecords: make(map[string]*types.WalletRecord),
Metadata: make(map[string]string),
Records: make(map[string]*types.Record),
AccessControl: make(map[string]types.DomainRole),
}
nullify.Fill(&secondLevelDomain)
Expand All @@ -42,7 +40,14 @@ func networkWithSecondLevelDomainObjects(t *testing.T, n int) (*network.Network,
buf, err := cfg.Codec.MarshalJSON(&state)
require.NoError(t, err)
cfg.GenesisState[types.ModuleName] = buf
return network.New(t, cfg), state.SecondLevelDomains

objs := make([]types.SecondLevelDomainResponse, n)
for i := range state.SecondLevelDomains {
objs[i].Name = state.SecondLevelDomains[i].Name
objs[i].Parent = state.SecondLevelDomains[i].Parent
objs[i].ExpirationDate = state.SecondLevelDomains[i].ExpirationDate
}
return network.New(t, cfg), objs
}

func TestShowSecondLevelDomain(t *testing.T) {
Expand All @@ -59,7 +64,7 @@ func TestShowSecondLevelDomain(t *testing.T) {

args []string
err error
obj types.SecondLevelDomain
obj types.SecondLevelDomainResponse
}{
{
desc: "found",
Expand Down

0 comments on commit 4524aa3

Please sign in to comment.