exred_nodetest v0.1.0 Exred.NodeTest

A helper module to set up tests for Exred nodes.

See example usage below. The module argument is the node module that will be tested.

start_node/0 will start the node. It will add the :pid and :node keys to the test context. :pid is the process id of the running node GenServer :node is the node attributes map:

  %{
    module :: atom,
    id :: atom
    name :: string,
    category :: string,
    info :: string,
    config :: map,
    ui_attributes :: map
  }

Example

(this would go into a test file)

defmodule Exred.Node.MynodeTest do

use ExUnit.Case
use Exred.NodeTest, module: Exred.Node.Mynode

setup_all do
  Exred.NodeTest.start_node
end

test "has pid", context do
  assert is_pid(context.pid)
end

end