Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Add TestGetWalletRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
foxytanuki committed Dec 27, 2023
1 parent 037740f commit 6d63850
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions x/registry/types/second_level_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,45 @@ func TestDomainValidate(t *testing.T) {
}
}

func TestGetWalletRecord(t *testing.T) {
domain := SecondLevelDomain{Name: "foo", Parent: "myc"}
testCases := []struct {
desc string
walletRecordType string
resp string
fn func()
}{
// BITCOIN
{desc: "Bitcoin Mainnet", walletRecordType: "BITCOIN_MAINNET_MAINNET", resp: "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2", fn: func() {
err := domain.UpdateWalletRecord("BITCOIN_DEFAULT_DEFAULT", "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2")
require.Nil(t, err)
}},
// EVM
{desc: "Ethereum Mainnet", walletRecordType: "ETHEREUM_MAINNET_MAINNET", resp: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", fn: func() {
err := domain.UpdateWalletRecord("EVM_DEFAULT_DEFAULT", "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266")
require.Nil(t, err)
}},
// MOVE
{desc: "Aptos Mainnet", walletRecordType: "APTOS_MAINNET_MAINNET", resp: "0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b", fn: func() {
err := domain.UpdateWalletRecord("MOVE_DEFAULT_DEFAULT", "0xeeff357ea5c1a4e7bc11b2b17ff2dc2dcca69750bfef1e1ebcaccf8c8018175b")
require.Nil(t, err)
}},
// SOLANA
{desc: "Solana Mainnet", walletRecordType: "SOLANA_MAINNET_MAINNET", resp: "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH", fn: func() {
err := domain.UpdateWalletRecord("SOLANA_DEFAULT_DEFAULT", "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH")
require.Nil(t, err)
}},
}

for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
tc.fn()
rec := domain.GetWalletRecord(tc.walletRecordType)
require.Equal(t, tc.resp, rec)
})
}
}

func TestDomainUpdateWalletRecord(t *testing.T) {
testCases := []struct {
walletRecordType string
Expand Down

0 comments on commit 6d63850

Please sign in to comment.