Best practices for unit testing with SSE events? #2572
Unanswered
GabrielBianconi
asked this question in
Q&A
Replies: 2 comments 3 replies
-
The SSE example includes tests, are thise helpful to answer your question maybe? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @jplatte, In practice that's how we did it. But the example is more like an integration test since you have to launch the server and call the entire handler. I was hoping to test just the spawned task ( Thanks! |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I'm trying to write unit tests for a function that writes
axum::response::sse::Event
's to a channel used bySse
. However,Event.buffer
is private and I can't find another way to retrieve the event's contents to ensure it was generated correctly.What is the best practice for testing this?
Here's a toy example - I want to write a unit test for
mini_worker
that checks that the events are sent correctly:axum version
0.7.4
Beta Was this translation helpful? Give feedback.
All reactions