Skip to content

Commit

Permalink
add basic lexicographical key test
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Aug 27, 2023
1 parent b2c7d50 commit cbc2ff4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
36 changes: 36 additions & 0 deletions x/poolmanager/types/keys_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package types_test

import (
"testing"

"github.com/stretchr/testify/require"

"github.com/osmosis-labs/osmosis/v19/x/poolmanager/types"
)

func TestFormatDenomTradePairKey(t *testing.T) {
tests := map[string]struct {
denom0 string
denom1 string
expectedKey string
}{
"happy path": {
denom0: "uosmo",
denom1: "uion",
expectedKey: "\x04|uion|uosmo",
},
"reversed denoms get reordered": {
denom0: "uion",
denom1: "uosmo",
expectedKey: "\x04|uion|uosmo",
},
}

for name, tc := range tests {
t.Run(name, func(t *testing.T) {
formatDenomTradePairKey := types.FormatDenomTradePairKey(tc.denom0, tc.denom1)
stringFormatDenomTradePairKeyString := string(formatDenomTradePairKey)
require.Equal(t, tc.expectedKey, stringFormatDenomTradePairKeyString)
})
}
}
1 change: 0 additions & 1 deletion x/txfees/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func (k Keeper) swapNonNativeFeeToDenom(ctx sdk.Context, denomToSwapTo string, f
// Skip this denom and move on to the next one.
continue
}

}

// Do the swap of this fee token denom to base denom.
Expand Down

0 comments on commit cbc2ff4

Please sign in to comment.