exred_nodetest v0.1.2 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
    start_node()
  end

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