Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (53 sloc) 1.3 KB
defmodule VMTest do
@sender "509c3480af8118842da87369eb616eb7b158724927c212b676c41ce6430d334a"
|> Base.decode16!(case: :lower)
import Test.Utils
use ExUnit.Case
setup_all do
Redis.reset()
on_exit(fn ->
Redis.reset()
end)
end
test "TransactionProcessor proccesses transactions" do
counter_code = read_test_wasm("counter.wasm")
TransactionPool.add(%{
code: counter_code,
env: %{
sender: @sender,
address: @sender,
contract_name: "Counter"
},
method: :increment_by,
params: [
1
]
})
TransactionProcessor.proccess_transactions(1)
TransactionProcessor.wait_until_done()
TransactionPool.add(%{
code: counter_code,
env: %{
sender: @sender,
address: @sender,
contract_name: "Counter"
},
method: :increment_by,
params: [
1
]
})
TransactionProcessor.proccess_transactions(1)
TransactionProcessor.wait_until_done()
assert VM.get(%{
code: counter_code,
env: %{
sender: @sender,
address: @sender,
contract_name: "Counter"
},
method: :get_count,
params: []
}) == {:ok, Cbor.encode(2)}
end
end