-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5cd57b
commit c572ab7
Showing
4 changed files
with
63 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,19 @@ jobs: | |
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
args: --timeout 300s | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21.3' | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Run tests | ||
run: go test -coverpkg=./... -coverprofile coverage.txt -v ./... | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: QuokkaStake/cosmos-validators-exporter |
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ config*.toml | |
cosmos-validators-exporter | ||
.idea/ | ||
dist/ | ||
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,40 @@ | ||
package generators | ||
|
||
import ( | ||
"main/pkg/constants" | ||
"main/pkg/fetchers" | ||
statePkg "main/pkg/state" | ||
"main/pkg/types" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestBalanceGeneratorNoState(t *testing.T) { | ||
t.Parallel() | ||
|
||
state := statePkg.NewState() | ||
generator := NewBalanceGenerator() | ||
results := generator.Generate(state) | ||
assert.Empty(t, results) | ||
} | ||
|
||
func TestBlockSetValidators(t *testing.T) { | ||
t.Parallel() | ||
|
||
state := statePkg.NewState() | ||
state.Set(constants.FetcherNameBalance, fetchers.BalanceData{ | ||
Balances: map[string]map[string][]types.Amount{ | ||
"chain": { | ||
"validator": { | ||
{Amount: 100, Denom: "uatom"}, | ||
{Amount: 200, Denom: "ustake"}, | ||
}, | ||
}, | ||
}, | ||
}) | ||
|
||
generator := NewBalanceGenerator() | ||
results := generator.Generate(state) | ||
assert.NotEmpty(t, results) | ||
} |