Skip to main content

published

Function published 

Source
pub fn published<T, E: Encoding<T>, O>(
    topic: &Topic<T, E, O>,
) -> Result<Vec<Message<T>>, Error>
Expand description

Returns all messages published to topic during the current test, in publish order (both directly by the test and by code it called).

Under encore test, subscriptions do not run automatically. Use this function to inspect published messages or pass them to handlers directly.

ⓘ
signed_up("ada").await?;
let published = encore::testing::published(&SIGNUPS)?;
assert_eq!(published.len(), 1);
assert_eq!(published[0].data.user_id, "ada");
send_welcome(published[0].clone()).await?;