@@ -21,6 +21,10 @@ import (
21
21
"github.com/burnt-labs/xion/x/globalfee/types"
22
22
)
23
23
24
+ const (
25
+ testStakingDenom = "stake"
26
+ )
27
+
24
28
func TestNewFeeDecorator (t * testing.T ) {
25
29
// Create a test subspace without key table
26
30
storeKey := storetypes .NewKVStoreKey (paramstypes .StoreKey )
@@ -34,9 +38,7 @@ func TestNewFeeDecorator(t *testing.T) {
34
38
types .ModuleName ,
35
39
)
36
40
37
- stakingDenomFunc := func (ctx sdk.Context ) string {
38
- return "stake"
39
- }
41
+ stakingDenomFunc := func (ctx sdk.Context ) string { return testStakingDenom }
40
42
41
43
// Test with subspace that doesn't have key table - should panic
42
44
require .Panics (t , func () {
@@ -71,9 +73,7 @@ func TestFeeDecoratorMethods(t *testing.T) {
71
73
}
72
74
subspace .SetParamSet (ctx .Ctx , & params )
73
75
74
- stakingDenomFunc := func (ctx sdk.Context ) string {
75
- return "stake"
76
- }
76
+ stakingDenomFunc := func (ctx sdk.Context ) string { return testStakingDenom }
77
77
78
78
decorator := ante .NewFeeDecorator (subspace , stakingDenomFunc )
79
79
@@ -89,7 +89,7 @@ func TestFeeDecoratorMethods(t *testing.T) {
89
89
require .NoError (t , err )
90
90
require .NotNil (t , zeroFees )
91
91
require .Len (t , zeroFees , 1 )
92
- require .Equal (t , "stake" , zeroFees [0 ].Denom )
92
+ require .Equal (t , testStakingDenom , zeroFees [0 ].Denom )
93
93
require .True (t , zeroFees [0 ].Amount .IsZero ())
94
94
95
95
// Test ContainsOnlyBypassMinFeeMsgs
@@ -147,9 +147,7 @@ func TestGetGlobalFeeEmptyParams(t *testing.T) {
147
147
}
148
148
subspace .SetParamSet (ctx .Ctx , & params )
149
149
150
- stakingDenomFunc := func (ctx sdk.Context ) string {
151
- return "stake"
152
- }
150
+ stakingDenomFunc := func (ctx sdk.Context ) string { return testStakingDenom }
153
151
154
152
decorator := ante .NewFeeDecorator (subspace , stakingDenomFunc )
155
153
@@ -158,7 +156,7 @@ func TestGetGlobalFeeEmptyParams(t *testing.T) {
158
156
require .NoError (t , err )
159
157
require .NotNil (t , globalFees )
160
158
require .Len (t , globalFees , 1 )
161
- require .Equal (t , "stake" , globalFees [0 ].Denom )
159
+ require .Equal (t , testStakingDenom , globalFees [0 ].Denom )
162
160
require .True (t , globalFees [0 ].Amount .IsZero ())
163
161
}
164
162
@@ -216,9 +214,7 @@ func TestContainsOnlyBypassMinFeeMsgsEdgeCases(t *testing.T) {
216
214
types .ModuleName ,
217
215
).WithKeyTable (types .ParamKeyTable ())
218
216
219
- stakingDenomFunc := func (ctx sdk.Context ) string {
220
- return "stake"
221
- }
217
+ stakingDenomFunc := func (ctx sdk.Context ) string { return testStakingDenom }
222
218
223
219
decorator := ante .NewFeeDecorator (subspace , stakingDenomFunc )
224
220
@@ -310,9 +306,7 @@ func TestContainsOnlyBypassMinFeeMsgsWithMessages(t *testing.T) {
310
306
types .ModuleName ,
311
307
).WithKeyTable (types .ParamKeyTable ())
312
308
313
- stakingDenomFunc := func (ctx sdk.Context ) string {
314
- return "stake"
315
- }
309
+ stakingDenomFunc := func (ctx sdk.Context ) string { return testStakingDenom }
316
310
317
311
decorator := ante .NewFeeDecorator (subspace , stakingDenomFunc )
318
312
@@ -450,9 +444,7 @@ func TestAnteHandle(t *testing.T) {
450
444
params := types .DefaultParams ()
451
445
subspace .SetParamSet (ctx .Ctx , & params )
452
446
453
- stakingDenomFunc := func (ctx sdk.Context ) string {
454
- return "stake"
455
- }
447
+ stakingDenomFunc := func (ctx sdk.Context ) string { return testStakingDenom }
456
448
457
449
decorator := ante .NewFeeDecorator (subspace , stakingDenomFunc )
458
450
0 commit comments