package types_test

import (
	"testing"

	"github.com/stretchr/testify/require"

	"github.com/bandprotocol/chain/v3/x/tunnel/types"
)

func TestStringRouterMemo(t *testing.T) {
	memo := types.NewRouterMemo(
		"router17c2txg2px6vna8a6v4ql4eh4ruvprerhytxvwt2ugp4qr473pajsyj9pgm",
		"17000",
		"0xDFCfEbF22e85193eDc37b8b136d4F3394987d1AE",
		10000000,
		"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZyMsxwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCVEMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEZ4w",
	)
	memoStr, err := memo.JSONString()
	require.NoError(t, err)
	require.Equal(
		t,
		`{"wasm":{"contract":"router17c2txg2px6vna8a6v4ql4eh4ruvprerhytxvwt2ugp4qr473pajsyj9pgm","msg":{"receive_band_data":{"dest_chain_id":"17000","dest_contract_address":"0xDFCfEbF22e85193eDc37b8b136d4F3394987d1AE","gas_limit":10000000,"payload":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZyMsxwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCVEMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEZ4w"}}}}`,
		memoStr,
	)
}
