4
0
Fork 0
Fork of the exw3 library. With our own additions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
exw3/test/exw3_test.exs

40 lines
863 B

7 years ago
defmodule EXW3Test do
use ExUnit.Case
doctest EXW3
setup_all do
%{
simple_storage_abi: EXW3.load_abi("test/examples/build/SimpleStorage.abi"),
accounts: EXW3.accounts
}
7 years ago
end
test "loads abi", context do
assert context[:simple_storage_abi] |> is_map
7 years ago
end
test "deploys contract and uses it", context do
contract_address = EXW3.Contract.deploy(
"test/examples/build/SimpleStorage.bin",
%{
from: Enum.at(context[:accounts], 0),
gas: 150000
}
)
7 years ago
contract_agent = EXW3.Contract.at context[:simple_storage_abi], contract_address
7 years ago
EXW3.Contract.get contract_agent, :abi
|> Kernel.inspect
|> IO.puts
EXW3.Contract.method(contract_agent, "get")
|> Kernel.inspect
|> IO.puts
7 years ago
end
test "gets accounts" do
assert EXW3.accounts |> is_list
end
end