[farmbot_ext: 12.1%] AutoSyncAssetHandler test for when auto_sync?() is enabled

pull/1184/head
Rick Carlino 2020-03-31 11:49:46 -05:00
parent 04c74b28f2
commit 431e05284a
1 changed files with 10 additions and 0 deletions

View File

@ -9,6 +9,7 @@ defmodule AutoSyncAssetHandlerTest do
alias FarmbotCore.{Asset, BotState, Leds}
def auto_sync_off, do: expect(Asset.Query, :auto_sync?, fn -> false end)
def auto_sync_on, do: expect(Asset.Query, :auto_sync?, fn -> true end)
def expect_sync_status_to_be(status),
do: expect(BotState, :set_sync_status, fn ^status -> :ok end)
@ -22,4 +23,13 @@ defmodule AutoSyncAssetHandlerTest do
expect_green_leds(:slow_blink)
AutoSyncAssetHandler.handle_asset("Point", 23, nil)
end
test "handling of deleted assets when auto_sync is enabled" do
auto_sync_on()
expect_sync_status_to_be("syncing")
expect_sync_status_to_be("synced")
expect_green_leds(:really_fast_blink)
expect_green_leds(:solid)
AutoSyncAssetHandler.handle_asset("Point", 32, nil)
end
end