From 8ea6a671d4a31e287b2ce7de799438106d1cbb37 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 27 Apr 2026 06:34:28 +0900 Subject: [PATCH] tests: init basic test structure --- tests/sources/github.rs | 47 +++++++++++++++++++++++++++++++++++++++++ tests/sources/mod.rs | 1 + tests/tests.rs | 1 + 3 files changed, 49 insertions(+) create mode 100644 tests/sources/github.rs create mode 100644 tests/sources/mod.rs create mode 100644 tests/tests.rs diff --git a/tests/sources/github.rs b/tests/sources/github.rs new file mode 100644 index 0000000..f7a3416 --- /dev/null +++ b/tests/sources/github.rs @@ -0,0 +1,47 @@ +use kagami::sources::KagamiSource; +pub use kagami::sources::KagamiSourceGithub; + +#[tokio::test] +async fn test_get_repos_by_user() -> anyhow::Result<()> { + KagamiSourceGithub::new(None) + .get_repositories_by_user("octocat", None, &Default::default()) + .await + .map(|repos| { + assert!(!repos.is_empty()); + for r in repos { + println!("{}: {}", r.url, r.name); + } + })?; + + Ok(()) +} + +#[tokio::test] +async fn test_get_repos_by_organization() -> anyhow::Result<()> { + KagamiSourceGithub::new(None) + .get_repositories_by_organization("github", None, false, &Default::default()) + .await + .map(|repos| { + assert!(!repos.is_empty()); + for r in repos { + println!("{}: {}", r.url, r.name); + } + })?; + + Ok(()) +} + +#[tokio::test] +async fn test_get_repos_by_stars() -> anyhow::Result<()> { + KagamiSourceGithub::new(None) + .get_repositories_by_stars("octocat", None, &Default::default()) + .await + .map(|repos| { + assert!(!repos.is_empty()); + for r in repos { + println!("{}: {}", r.url, r.name); + } + })?; + + Ok(()) +} diff --git a/tests/sources/mod.rs b/tests/sources/mod.rs new file mode 100644 index 0000000..6a5a51c --- /dev/null +++ b/tests/sources/mod.rs @@ -0,0 +1 @@ +mod github; diff --git a/tests/tests.rs b/tests/tests.rs new file mode 100644 index 0000000..99bbf4b --- /dev/null +++ b/tests/tests.rs @@ -0,0 +1 @@ +mod sources;