smart_city_test v0.9.1 SmartCity.TestHelper View Source

Common utilities for use in test cases

Link to this section Summary

Functions

Helper function for asynchronous testing

Link to this section Types

Link to this type

asserting_function()

View Source
asserting_function() :: (() -> no_return() | boolean())

Link to this section Functions

Link to this function

eventually(function, dwell \\ 2000, max_tries \\ 5)

View Source
eventually(asserting_function(), integer(), integer()) :: :ok | none()

Helper function for asynchronous testing

  • Repeats the given block (zero-arity function) until a timeout occurs or it returns a truthy value.
  • Catches ExUnit assertions and continues to try the block
  • Re-runs block one last time if it times out so assertions are run and throw helpful diffs, etc.