   end
 
   test "wait" do
+    expect(Stubs, :wait, fn ms ->
+      if ms == 1000 do
+        :ok
+      end
+    end)
+
     assert :ok = SysCalls.wait(Stubs, 1000)
-    assert_receive {:wait, [1000]}
   end
 
   test "named_pin" do

defmodule FarmbotCeleryScript.SysCallsTest do
  use ExUnit.Case, async: false
  use Mimic
  alias FarmbotCeleryScript.{SysCalls, SysCalls.Stubs}

  test "point, OK" do
    expect(Stubs, :point, 1, fn _kind, 1 ->

  end

  test "set_servo_angle errors" do
    error = {:error, "boom"}

    expect(Stubs, :set_servo_angle, 2, fn num, _val ->
      if num == 5 do
        :ok
      else
        error
      end
    end)

    assert error == SysCalls.set_servo_angle(Stubs, 40, -5)
    assert :ok == SysCalls.set_servo_angle(Stubs, 5, 40)
  end

  test "get_sequence" do
    nothing = %AST{
      kind: "nothing",
      args: {},
      body: []
    }

    err = {:error, "sequence not found"}

    expect(Stubs, :get_sequence, 2, fn sequence_id ->
      if sequence_id == 321 do
        err
      else
        nothing
      end
    end)

    assert nothing == SysCalls.get_sequence(Stubs, 123)
    assert err == SysCalls.get_sequence(Stubs, 321)
  end
end
