# `LangchainPrompt.TestAssertions`
[🔗](https://github.com/exfoundry/langchain_prompt/blob/v0.1.0/lib/langchain_prompt/test_assertions.ex#L1)

ExUnit helpers for asserting on `LangchainPrompt.Adapters.Test` calls.

Import this in your test files:

    import LangchainPrompt.TestAssertions

## Macros

- `assert_adapter_called/0` — asserts the adapter was called (ignores payload).
- `assert_adapter_called/1` — asserts the adapter was called and runs an
  assertion function on the payload.
- `refute_adapter_called/0` — asserts the adapter was NOT called.

## Example

    test "sends the right system prompt" do
      LangchainPrompt.execute(MyPrompt, assigns)

      assert_adapter_called(fn payload ->
        system_msg = hd(payload.messages)
        assert system_msg.role == :system
        assert system_msg.content =~ "summarise"
      end)
    end

# `assert_adapter_called`
*macro* 

Asserts the test adapter was called, and optionally inspects the payload.

When called with a function, the function receives a map with:
- `:messages` — the list of `LangchainPrompt.Message` structs sent to the adapter
- `:opts` — the profile opts map

# `refute_adapter_called`
*macro* 

Asserts the test adapter was NOT called.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
