refactor: create git-test crate

This commit is contained in:
Paul Campbell 2024-06-06 18:29:37 +01:00
parent df755e583b
commit 1ca13bb0ae
6 changed files with 33 additions and 7 deletions

View file

@ -6,6 +6,7 @@ members = [
"crates/config", "crates/config",
"crates/config/test", "crates/config/test",
"crates/git", "crates/git",
"crates/git/test",
"crates/forge", "crates/forge",
"crates/forge-forgejo", "crates/forge-forgejo",
"crates/forge-github", "crates/forge-github",
@ -27,6 +28,7 @@ git-next-server = { path = "crates/server" }
git-next-config = { path = "crates/config" } git-next-config = { path = "crates/config" }
git-next-config-test = { path = "crates/config/test" } git-next-config-test = { path = "crates/config/test" }
git-next-git = { path = "crates/git" } git-next-git = { path = "crates/git" }
git-next-git-test = { path = "crates/git/test" }
git-next-forge = { path = "crates/forge" } git-next-forge = { path = "crates/forge" }
git-next-forge-forgejo = { path = "crates/forge-forgejo" } git-next-forge-forgejo = { path = "crates/forge-forgejo" }
git-next-forge-github = { path = "crates/forge-github" } git-next-forge-github = { path = "crates/forge-github" }

View file

@ -40,6 +40,7 @@ tokio = { workspace = true }
[dev-dependencies] [dev-dependencies]
# Testing # Testing
git-next-config-test = { workspace = true } git-next-config-test = { workspace = true }
git-next-git-test = { workspace = true }
assert2 = { workspace = true } assert2 = { workspace = true }
rand = { workspace = true } rand = { workspace = true }

View file

@ -569,6 +569,8 @@ mod forgejo {
} }
mod given { mod given {
pub use git_next_config_test::given::*; pub use git_next_config_test::given::*;
pub use git_next_git_test::given::*;
use std::collections::HashMap; use std::collections::HashMap;
use kxio::network::{MockNetwork, StatusCode}; use kxio::network::{MockNetwork, StatusCode};
@ -644,13 +646,6 @@ mod forgejo {
headers headers
} }
pub fn a_commit() -> git::Commit {
git::Commit::new(
git::commit::Sha::new(a_name()),
git::commit::Message::new(a_name()),
)
}
pub fn a_forgejo_forge( pub fn a_forgejo_forge(
repo_details: &git::RepoDetails, repo_details: &git::RepoDetails,
net: impl Into<kxio::network::Network>, net: impl Into<kxio::network::Network>,

View file

@ -0,0 +1,18 @@
[package]
name = "git-next-git-test"
version = { workspace = true }
edition = { workspace = true }
[dependencies]
git-next-git = { workspace = true }
git-next-config-test = { workspace = true }
rand = { workspace = true }
kxio = { workspace = true }
# serde_json = { workspace = true }
[lints.clippy]
nursery = { level = "warn", priority = -1 }
# pedantic = "warn"
unwrap_used = "warn"
expect_used = "warn"

View file

@ -0,0 +1,9 @@
use git_next_config_test::given::a_name;
use git_next_git as git;
pub fn a_commit() -> git::Commit {
git::Commit::new(
git::commit::Sha::new(a_name()),
git::commit::Message::new(a_name()),
)
}

View file

@ -0,0 +1 @@
pub mod given;