Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ignite
GitHub Repository: ignite/cli
Path: blob/main/integration/app/cmd_proto_path_test.go
1007 views
1
//go:build !relayer
2
3
package app_test
4
5
import (
6
"os"
7
"path/filepath"
8
"testing"
9
10
"github.com/stretchr/testify/require"
11
"gopkg.in/yaml.v3"
12
13
"github.com/ignite/cli/v29/ignite/config/chain"
14
"github.com/ignite/cli/v29/ignite/config/chain/base"
15
v1 "github.com/ignite/cli/v29/ignite/config/chain/v1"
16
"github.com/ignite/cli/v29/ignite/pkg/xyaml"
17
envtest "github.com/ignite/cli/v29/integration"
18
)
19
20
const newProtoPath = "myProto"
21
22
var (
23
bobName = "bob"
24
cfg = v1.Config{
25
Config: base.Config{
26
Version: 1,
27
Build: base.Build{
28
Proto: base.Proto{
29
Path: newProtoPath,
30
},
31
},
32
Accounts: []base.Account{
33
{
34
Name: "alice",
35
Coins: []string{"100000000000token", "10000000000000000000stake"},
36
Mnemonic: "slide moment original seven milk crawl help text kick fluid boring awkward doll wonder sure fragile plate grid hard next casual expire okay body",
37
},
38
{
39
Name: bobName,
40
Coins: []string{"100000000000token", "10000000000000000000stake"},
41
Mnemonic: "trap possible liquid elite embody host segment fantasy swim cable digital eager tiny broom burden diary earn hen grow engine pigeon fringe claim program",
42
},
43
},
44
Faucet: base.Faucet{
45
Name: &bobName,
46
Coins: []string{"500token", "100000000stake"},
47
Host: ":4501",
48
},
49
Genesis: xyaml.Map{"chain_id": "mars-1"},
50
},
51
Validators: []v1.Validator{
52
{
53
Name: "alice",
54
Bonded: "100000000stake",
55
},
56
},
57
}
58
)
59
60
func TestChangeProtoPath(t *testing.T) {
61
var (
62
env = envtest.New(t)
63
app = env.ScaffoldApp("github.com/test/protopath", "--proto-dir", newProtoPath)
64
appPath = app.SourcePath()
65
cfgPath = filepath.Join(appPath, chain.ConfigFilenames[0])
66
)
67
68
// set the custom config path.
69
file, err := os.Create(cfgPath)
70
require.NoError(t, err)
71
require.NoError(t, yaml.NewEncoder(file).Encode(cfg))
72
require.NoError(t, file.Close())
73
app.SetConfigPath(cfgPath)
74
75
app.Scaffold(
76
"create a list with a custom proto path from config",
77
false,
78
"list", "listUser", "email",
79
)
80
81
app.EnsureSteady()
82
}
83
84