solana-go/generic_instruction_test.go

26 lines
493 B
Go
Raw Normal View History

2021-09-10 06:00:41 -07:00
package solana
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestNewInstruction(t *testing.T) {
progID := MemoProgramID
accounts := []*AccountMeta{
Meta(SPLAssociatedTokenAccountProgramID).SIGNER().WRITE(),
}
data := []byte("hello world")
ins := NewInstruction(progID, accounts, data)
require.Equal(t, progID, ins.ProgramID())
require.Equal(t, accounts, ins.Accounts())
{
got, err := ins.Data()
require.NoError(t, err)
require.Equal(t, data, got)
}
}