• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

agentjido / jido / d6870e1ed85c6d9d5a1caf0b0f667049043703e1

23 Feb 2025 07:16PM UTC coverage: 78.032% (-1.5%) from 79.538%
d6870e1ed85c6d9d5a1caf0b0f667049043703e1

push

github

mikehostetler
Refactor Signal Bus and Serialization Infrastructure

- Remove deprecated Bus and Bus Adapter modules
- Introduce new Signal Bus components with improved routing and dispatch
- Add Signal ID generation with UUID7 support
- Implement new serialization modules for JSON encoding/decoding
- Update test infrastructure to support new Signal Bus architecture
- Enhance routing and dispatch mechanisms
- Improve signal ID generation and handling

537 of 641 new or added lines in 17 files covered. (83.78%)

33 existing lines in 6 files now uncovered.

1840 of 2358 relevant lines covered (78.03%)

31173.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/test/support/assertions.ex
1
defmodule JidoTest.Helpers.Assertions do
2
  @moduledoc false
3
  import ExUnit.Assertions
4

5
  @doc """
6
  Asserts that a module implements a specified behaviour.
7

8
  ## Examples
9

10
      assert_implements(MyModule, GenServer)
11
  """
12
  def assert_implements(module, behaviour) do
NEW
13
    all = Keyword.take(module.__info__(:attributes), [:behaviour])
×
14

NEW
15
    assert [behaviour] in Keyword.values(all)
×
16
  end
17

18
  @doc """
19
  Partially adapted from Thomas Millar's wait_for
20
  https://gist.github.com/thmsmlr/8b32cc702acb48f39e653afc0902374f
21

22
  This will assert continously for the :check_interval until the :timeout
23
  has been reached.
24

25
  NOTE: In general, it is preferable to wait for some signal like a telemetry
26
  event or message, but sometimes this is just easier.
27
  """
28
  defmacro assert_eventually(assertion, opts \\ []) do
29
    quote do
30
      JidoTest.Helpers.Assertions.wait_for(
31
        fn ->
32
          assert unquote(assertion)
33
        end,
34
        unquote(opts)
35
      )
36
    end
37
  end
38

39
  def wait_for(fun, opts \\ []) do
40
    timeout = Keyword.get(opts, :timeout, 100)
4✔
41
    check_interval = Keyword.get(opts, :check_interval, 10)
4✔
42

43
    start_time = System.monotonic_time(:millisecond)
4✔
44
    ref = make_ref()
4✔
45

46
    try do
4✔
47
      do_wait_for(fun, start_time, timeout, ref, check_interval)
4✔
48
    catch
49
      {:wait_for_timeout, ^ref, last_error} ->
50
        message = """
×
51
        Assertion did not succeed within #{timeout}ms.
×
52
        Last failure:
53
        #{Exception.format(:error, last_error, [])}
×
54
        """
55

56
        flunk(message)
×
57
    end
58
  end
59

60
  defp do_wait_for(fun, start_time, timeout, ref, check_interval) do
4✔
61
    fun.()
4✔
62
    :ok
63
  rescue
64
    error in [ExUnit.AssertionError] ->
×
65
      current_time = System.monotonic_time(:millisecond)
×
66

67
      if current_time - start_time < timeout do
×
68
        Process.sleep(check_interval)
×
69
        do_wait_for(fun, start_time, timeout, ref, check_interval)
×
70
      else
71
        throw({:wait_for_timeout, ref, error})
×
72
      end
73
  end
74
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc