-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2c7d50
commit cbc2ff4
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters