cleanup + add tests

pull/363/head
connor rigby 2017-08-28 14:34:48 -07:00
parent f1996c9db7
commit 7ea89c1cc4
2 changed files with 34 additions and 3 deletions

View File

@ -23,7 +23,4 @@ defmodule Farmbot.Lib.Helpers do
end
end
def rollbar_occurrence_data do
Application.get_env(:farmbot, :rollbar_occurrence_data, %{})
end
end

View File

@ -0,0 +1,34 @@
defmodule Farmbot.Lib.HelpersTest do
@moduledoc "Tests helper functions."
use ExUnit.Case
test "tests uuid function" do
refute Farmbot.Lib.Helpers.uuid?("123,123,123")
assert Farmbot.Lib.Helpers.uuid?(UUID.uuid1)
end
end
defmodule F do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [], [])
end
def init([]) do
children = [
worker(SystemRegistry.Monitor, [
[:state, :network_interface, "wlan0", :ipv4_address], {__MODULE__, :netchange, [:old, :new]}
])
]
supervise(children, [strategy: :one_for_one])
end
def netchange(_old, _new) do
# Do something when the key changes
end
end