git-next/crates/forge/src/tests.rs
Paul Campbell df352443b7
All checks were successful
ci/woodpecker/cron/cron-docker-builder Pipeline was successful
ci/woodpecker/cron/push-next Pipeline was successful
ci/woodpecker/cron/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Rust / build (push) Successful in 1m21s
feat: GitDir tracks when repo is cloned by git-next
2024-07-06 15:08:13 +01:00

45 lines
1.2 KiB
Rust

//
use super::*;
use git_next_config as config;
use git_next_git::{self as git, RepoDetails};
#[test]
fn test_forgejo_name() {
let net = Network::new_mock();
let repo_details = given_repo_details(config::ForgeType::ForgeJo);
let forge = Forge::create(repo_details, net);
assert_eq!(forge.name(), "forgejo");
}
#[test]
fn test_github_name() {
let net = Network::new_mock();
let repo_details = given_repo_details(config::ForgeType::GitHub);
let forge = Forge::create(repo_details, net);
assert_eq!(forge.name(), "github");
}
fn given_fs() -> kxio::fs::FileSystem {
kxio::fs::temp().unwrap_or_else(|e| {
println!("{e}");
panic!("fs")
})
}
fn given_repo_details(forge_type: config::ForgeType) -> RepoDetails {
let fs = given_fs();
git::common::repo_details(
1,
git::Generation::default(),
config::common::forge_details(1, forge_type),
Some(config::common::repo_config(
1,
config::RepoConfigSource::Repo,
)),
config::GitDir::new(
fs.base().to_path_buf(),
config::git_dir::StoragePathType::Internal,
),
)
}