DEVELOPMENT ENVIRONMENT

~liljamo/canwa

19620a3f42c717840fd79edda342616159b0f6ff — Jonni Liljamo 16 days ago ffae960 master
feat: per service config tests
2 files changed, 51 insertions(+), 0 deletions(-)

M src/service/gotify.rs
M src/service/matrix.rs
M src/service/gotify.rs => src/service/gotify.rs +25 -0
@@ 53,3 53,28 @@ impl Service for GotifyService {
        Ok(())
    }
}

#[cfg(test)]
mod tests {
    use crate::config::Config;

    use super::*;

    #[tokio::test]
    async fn config() {
        Config::from_str(
            r#"
        [services.g]
        type = "gotify"
        instance = "gotify.tld"
        token = "secret"
        "#,
        )
        .await
        .unwrap()
        .services["g"]
            .as_any()
            .downcast_ref::<GotifyConfig>()
            .unwrap();
    }
}

M src/service/matrix.rs => src/service/matrix.rs +26 -0
@@ 97,3 97,29 @@ impl Service for MatrixService {
        Ok(())
    }
}

#[cfg(test)]
mod tests {
    use crate::config::Config;

    use super::*;

    #[tokio::test]
    async fn config() {
        Config::from_str(
            r#"
        [services.m]
        type = "matrix"
        instance = "matrix.tld"
        token = "secret"
        room = "!room:matrix.tld"
        "#,
        )
        .await
        .unwrap()
        .services["m"]
            .as_any()
            .downcast_ref::<MatrixConfig>()
            .unwrap();
    }
}