mirror of
https://github.com/LemmyNet/activitypub-federation-rust.git
synced 2024-05-19 09:28:04 +00:00
add test
This commit is contained in:
parent
579319e755
commit
5798eb35c6
|
@ -341,3 +341,22 @@ impl<T: Clone> FederationMiddleware<T> {
|
|||
FederationMiddleware(config)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[tokio::test]
|
||||
async fn test_url_is_local() -> Result<(), Error> {
|
||||
let config = FederationConfig::builder()
|
||||
.domain("example.com")
|
||||
.app_data(1)
|
||||
.build()
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
true,
|
||||
config.is_local_url(&Url::parse("http://example.com")?)
|
||||
);
|
||||
assert_eq!(false, config.is_local_url(&Url::parse("http://other.com")?));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue