From 9c3b1e6157f49eecb2c0bcf77dc9c8c354b9d753 Mon Sep 17 00:00:00 2001 From: Sergey Date: Sat, 22 Jun 2024 23:47:07 +0300 Subject: [PATCH] chore: add unbonds generator test --- ...delegators_test.go => delegations_test.go} | 0 pkg/generators/unbonds_test.go | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+) rename pkg/generators/{delegators_test.go => delegations_test.go} (100%) create mode 100644 pkg/generators/unbonds_test.go diff --git a/pkg/generators/delegators_test.go b/pkg/generators/delegations_test.go similarity index 100% rename from pkg/generators/delegators_test.go rename to pkg/generators/delegations_test.go diff --git a/pkg/generators/unbonds_test.go b/pkg/generators/unbonds_test.go new file mode 100644 index 0000000..56856c8 --- /dev/null +++ b/pkg/generators/unbonds_test.go @@ -0,0 +1,36 @@ +package generators + +import ( + "main/pkg/constants" + "main/pkg/fetchers" + statePkg "main/pkg/state" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestUnbondsGeneratorNoState(t *testing.T) { + t.Parallel() + + state := statePkg.NewState() + generator := NewUnbondsGenerator() + results := generator.Generate(state) + assert.Empty(t, results) +} + +func TestUnbondsGeneratorNotEmptyState(t *testing.T) { + t.Parallel() + + state := statePkg.NewState() + state.Set(constants.FetcherNameUnbonds, fetchers.UnbondsData{ + Unbonds: map[string]map[string]uint64{ + "chain": { + "validator": 100, + }, + }, + }) + + generator := NewUnbondsGenerator() + results := generator.Generate(state) + assert.NotEmpty(t, results) +}