FakeAnalyticsProvider
A vendor that records instead of sending, for tests in apps that use Herald.
It implements all five capabilities, so you can register it as a real provider and the test then runs through the composition root you actually ship — factory chain, dispatcher and all:
val analytics = FakeAnalyticsProvider()
val herald = Herald {
provider(name = "test", events = analytics, properties = analytics)
}
viewModel.onPayTapped()
analytics.assertTracked("checkout_pay_tapped") { param("plan", "pro") }
analytics.assertNothingElseTracked()For a class that only tracks events a lambda is smaller — EventTrackerService { recorded += it } needs no dependency. Reach for this when the test spans more than one capability, cares about ordering between them, or runs through a real Herald.
Safe to call from several coroutines at once.
Properties
Functions
Asserts that the user was identified as userId at some point. Unlike assertPropertySet this is historical, not current: an identify followed by reset still passes. Use records to assert on the order.
Asserts that every event tracked has already been named by an earlier assertion.
Asserts that no event was tracked at all.
Asserts that no event with name was tracked.
Asserts that exactly one event with name was tracked, and applies assertions to it.