From 6d638502db56cc65714cbcbb87980bb47c46ef3e Mon Sep 17 00:00:00 2001 From: foxytanuki Date: Wed, 27 Dec 2023 20:09:36 +0900 Subject: [PATCH] Add TestGetWalletRecord --- x/registry/types/second_level_domain_test.go | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/x/registry/types/second_level_domain_test.go b/x/registry/types/second_level_domain_test.go index 5e96f61e..b03e1881 100644 --- a/x/registry/types/second_level_domain_test.go +++ b/x/registry/types/second_level_domain_test.go @@ -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