Closed sholsapp closed 7 years ago
You can call the service in a unit test. It returns a future, and you can probably call wait
on the future. I'm not sure what specifically you are asking :)
In my brain, I was thinking I would write a unit test that has something like:
info!("Serving on {}...", addr);
TcpServer::new(Http, addr)
.serve(move || Ok(server::MyService {}));
This starts an entire TCP server though. You're saying within a unit test, just instantiate the service and test that directly, yea? That makes sense, duh.
Either way, one or two unit tests would've make this even more bone head. :)
Hey there, I'm curious what pattern I should employ to write unit tests for services and cannot find any examples here or elsewhere. Can someone point me at an example?