Skip to content

Commit

Permalink
test: ValidateClaimWindowOpenOffsetBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed May 31, 2024
1 parent 076627a commit 8993488
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions x/shared/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,33 @@ func TestParams_ValidateNumBlocksPerSession(t *testing.T) {
})
}
}

func TestParams_ValidateClaimWindowOpenOffsetBlocks(t *testing.T) {
tests := []struct {
desc string
claimWindowOpenOffsetBlocks any
err error
}{
{
desc: "invalid type",
claimWindowOpenOffsetBlocks: "invalid",
err: ErrSharedParamInvalid.Wrapf("invalid parameter type: %T", "invalid"),
},
{
desc: "valid ClaimWindowOpenOffsetBlocks",
claimWindowOpenOffsetBlocks: uint64(4),
},
}

for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
err := ValidateClaimWindowOpenOffsetBlocks(tt.claimWindowOpenOffsetBlocks)
if tt.err != nil {
require.Error(t, err)
require.Contains(t, err.Error(), tt.err.Error())
} else {
require.NoError(t, err)
}
})
}
}

0 comments on commit 8993488

Please sign in to comment.