From 8993488d1c3376d67e451697da92889cb3d5f4a6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 31 May 2024 10:13:37 +0200 Subject: [PATCH] test: ValidateClaimWindowOpenOffsetBlocks --- x/shared/types/params_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/x/shared/types/params_test.go b/x/shared/types/params_test.go index a2611b04a..f64cc33af 100644 --- a/x/shared/types/params_test.go +++ b/x/shared/types/params_test.go @@ -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) + } + }) + } +}