forgejo-todo-checker/src/issues/tests.rs
Paul Campbell d161d0104e
All checks were successful
Test / test (push) Successful in 10s
feat: flag markers where issue is closed
2024-09-20 16:05:12 +01:00

32 lines
690 B
Rust

use std::collections::HashSet;
use crate::tests::a_config;
//
use super::*;
use anyhow::Result;
use kxio::network::StatusCode;
#[tokio::test]
async fn fetch_lists_issues() -> Result<()> {
//given
let mut net = kxio::network::MockNetwork::new();
net.add_get_response(
"https://git.kemitix.net/api/v1/repos/kemitix/test/issues?state=open",
StatusCode::OK,
r#"[{"number":13},{"number":64}]"#,
);
let config = a_config(net.into(), kxio::fs::temp()?)?;
//when
let result = fetch_open_issues(&config).await?;
//then
assert_eq!(
result,
HashSet::from_iter(vec![Issue::new(13), Issue::new(64)])
);
Ok(())
}