-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #4, #6 - adds revote notifications for telegram - adds proposals error and vote query error notifications for telegram - adds tests infrastructure and codecov
- Loading branch information
1 parent
b40b1f7
commit 9725ebc
Showing
16 changed files
with
990 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
config.toml | ||
config2.toml | ||
main | ||
*.json | ||
.idea | ||
cover.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestValidateChainWithEmptyName(t *testing.T) { | ||
t.Parallel() | ||
|
||
chain := Chain{ | ||
Name: "", | ||
} | ||
|
||
err := chain.Validate() | ||
assert.NotEqual(t, err, nil, "Error should be presented!") | ||
} | ||
|
||
func TestValidateChainWithoutEndpoints(t *testing.T) { | ||
t.Parallel() | ||
|
||
chain := Chain{ | ||
Name: "chain", | ||
LCDEndpoints: []string{}, | ||
} | ||
|
||
err := chain.Validate() | ||
assert.NotEqual(t, err, nil, "Error should be presented!") | ||
} | ||
|
||
func TestValidateChainWithoutWallets(t *testing.T) { | ||
t.Parallel() | ||
|
||
chain := Chain{ | ||
Name: "chain", | ||
LCDEndpoints: []string{"endpoint"}, | ||
Wallets: []string{}, | ||
} | ||
|
||
err := chain.Validate() | ||
assert.NotEqual(t, err, nil, "Error should be presented!") | ||
} | ||
|
||
func TestValidateChainWithValidConfig(t *testing.T) { | ||
t.Parallel() | ||
|
||
chain := Chain{ | ||
Name: "chain", | ||
LCDEndpoints: []string{"endpoint"}, | ||
Wallets: []string{"wallet"}, | ||
} | ||
|
||
err := chain.Validate() | ||
assert.Equal(t, err, nil, "Error should not be presented!") | ||
} | ||
|
||
func TestChainGetNameWithoutPrettyName(t *testing.T) { | ||
t.Parallel() | ||
|
||
chain := Chain{ | ||
Name: "chain", | ||
PrettyName: "", | ||
} | ||
|
||
err := chain.GetName() | ||
assert.Equal(t, err, "chain", "Chain name should match!") | ||
} | ||
|
||
func TestChainGetNameWithPrettyName(t *testing.T) { | ||
t.Parallel() | ||
|
||
chain := Chain{ | ||
Name: "chain", | ||
PrettyName: "chain-pretty", | ||
} | ||
|
||
err := chain.GetName() | ||
assert.Equal(t, err, "chain-pretty", "Chain name should match!") | ||
} | ||
|
||
func TestValidateConfigNoChains(t *testing.T) { | ||
t.Parallel() | ||
|
||
config := Config{ | ||
Chains: []Chain{}, | ||
} | ||
err := config.Validate() | ||
assert.NotEqual(t, err, nil, "Error should be presented!") | ||
} | ||
|
||
func TestValidateConfigInvalidChain(t *testing.T) { | ||
t.Parallel() | ||
|
||
config := Config{ | ||
Chains: []Chain{ | ||
{ | ||
Name: "", | ||
}, | ||
}, | ||
} | ||
err := config.Validate() | ||
assert.NotEqual(t, err, nil, "Error should be presented!") | ||
} | ||
|
||
func TestValidateConfigValidChain(t *testing.T) { | ||
t.Parallel() | ||
|
||
config := Config{ | ||
Chains: []Chain{ | ||
{ | ||
Name: "chain", | ||
LCDEndpoints: []string{"endpoint"}, | ||
Wallets: []string{"wallet"}, | ||
}, | ||
}, | ||
} | ||
err := config.Validate() | ||
assert.Equal(t, err, nil, "Error should not be presented!") | ||
} | ||
|
||
func TestFindChainByNameIfPresent(t *testing.T) { | ||
t.Parallel() | ||
|
||
chains := Chains{ | ||
{Name: "chain1"}, | ||
{Name: "chain2"}, | ||
} | ||
|
||
chain := chains.FindByName("chain2") | ||
assert.NotEqual(t, chain, nil, "Chain should be presented!") | ||
} | ||
|
||
func TestFindChainByNameIfNotPresent(t *testing.T) { | ||
t.Parallel() | ||
|
||
chains := Chains{ | ||
{Name: "chain1"}, | ||
{Name: "chain2"}, | ||
} | ||
|
||
chain := chains.FindByName("chain3") | ||
assert.Nil(t, chain, "Chain should not be presented!") | ||
} | ||
|
||
func TestGetKeplrLink(t *testing.T) { | ||
t.Parallel() | ||
|
||
chain := Chain{ | ||
KeplrName: "chain", | ||
} | ||
|
||
link := chain.GetKeplrLink("proposal") | ||
assert.Equal( | ||
t, | ||
link, | ||
"https://wallet.keplr.app/#/chain/governance?detailId=proposal", | ||
"Chain Keplr link is wrong!", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.