Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinGuayacan committed Dec 20, 2022
1 parent 40795f4 commit 5487801
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 28 deletions.
1 change: 0 additions & 1 deletion lib/chainweb/pact/local.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ defmodule Kadena.Chainweb.Pact.Local do
@headers [{"Content-Type", "application/json"}]

@impl true

def process(%Command{} = cmd, network, chain_id) do
request_body = get_json_request_body(cmd)

Expand Down
67 changes: 40 additions & 27 deletions test/chainweb/pact/local_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ defmodule Kadena.Chainweb.Pact.LocalTest do

alias Kadena.Types.{
Command,
CommandsList,
PactTransactionHash,
Signature,
SignaturesList
Expand All @@ -31,35 +30,49 @@ defmodule Kadena.Chainweb.Pact.LocalTest do

%{
exec_command: exec_command,
local_response:
{:ok,
%Kadena.Chainweb.Pact.LocalResponse{
continuation: nil,
events: nil,
gas: 7,
logs: "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
meta_data: %{
block_height: 2_820_655,
block_time: 1_671_202_287_339_852,
prev_block_hash: "gpJ3rn9hyE5eGMuooSdnlEMNuvjvGZtkV37IsEVtffw",
public_meta: %{
chain_id: "0",
creation_time: 1_667_249_173,
gas_limit: 1000,
gas_price: 1.0e-6,
sender: "k:554754f48b16df24b552f6832dda090642ed9658559fef9f3ee1bb4637ea7c94",
ttl: 28_800
}
},
req_key: "-1npoTU2Mi71pKE_oteJiJuHuXTXxoObJm8zzVRK2pk",
result: %{data: 11, status: "success"},
tx_id: nil
}}
continuation: nil,
events: nil,
gas: 7,
logs: "wsATyGqckuIvlm89hhd2j4t6RMkCrcwJe_oeCYr7Th8",
meta_data: %{
# block_height: 2_815_727,
# block_time: 1_671_054_330_981_668,
# prev_block_hash: "asisNr3nuU0t357i2bxMVUiIWDVHAMtncJHtmyENbio",
public_meta: %{
chain_id: "0",
creation_time: 1_667_249_173,
gas_limit: 1000,
gas_price: 1.0e-6,
sender: "k:554754f48b16df24b552f6832dda090642ed9658559fef9f3ee1bb4637ea7c94",
ttl: 28_800
}
},
req_key: "-1npoTU2Mi71pKE_oteJiJuHuXTXxoObJm8zzVRK2pk",
result: %{data: 11, status: "success"},
tx_id: nil
}
end

test "with a exec Command", %{exec_command: exec_command, local_response: local_response} do
^local_response = Pact.local(exec_command)
test "with a exec Command", %{
exec_command: exec_command,
continuation: continuation,
events: events,
gas: gas,
logs: logs,
meta_data: meta_data,
req_key: req_key,
result: result,
tx_id: tx_id
} do
{:ok, response} = Pact.local(exec_command)
assert(continuation == response.continuation)
assert(events == response.events)
assert(gas == response.gas)
assert(logs == response.logs)
assert(meta_data.public_meta == response.meta_data.public_meta)
assert(req_key == response.req_key)
assert(result == response.result)
assert(tx_id == response.tx_id)
end

test "with a invalid Command", %{} do
Expand Down

0 comments on commit 5487801

Please sign in to comment.