keyforkd: complicate middleware test
This commit is contained in:
parent
b810ab2e90
commit
8510e382d2
|
@ -100,6 +100,14 @@ mod tests {
|
||||||
field: String,
|
field: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Test {
|
||||||
|
fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
field: "hello world!".to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct App;
|
struct App;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
@ -118,15 +126,16 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&mut self, req: Test) -> Self::Future {
|
fn call(&mut self, req: Test) -> Self::Future {
|
||||||
Box::pin(async { Ok(req) })
|
Box::pin(async {
|
||||||
|
assert_eq!(req.field, Test::new().field);
|
||||||
|
Ok(req)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn can_serde_responses() {
|
async fn can_serde_responses() {
|
||||||
let content = serialize(&Test {
|
let content = serialize(&Test::new())
|
||||||
field: "hello world!".to_string(),
|
|
||||||
})
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut service = ServiceBuilder::new()
|
let mut service = ServiceBuilder::new()
|
||||||
.layer(BincodeLayer::<Test>::new())
|
.layer(BincodeLayer::<Test>::new())
|
||||||
|
|
Loading…
Reference in New Issue