2024-06-01 12:03:30 +01:00
|
|
|
//
|
|
|
|
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);
|
2024-06-19 07:03:08 +01:00
|
|
|
let forge = Forge::create(repo_details, net);
|
2024-06-01 12:03:30 +01:00
|
|
|
assert_eq!(forge.name(), "forgejo");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_github_name() {
|
|
|
|
let net = Network::new_mock();
|
|
|
|
let repo_details = given_repo_details(config::ForgeType::GitHub);
|
2024-06-19 07:03:08 +01:00
|
|
|
let forge = Forge::create(repo_details, net);
|
2024-06-01 12:03:30 +01:00
|
|
|
assert_eq!(forge.name(), "github");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn given_fs() -> kxio::fs::FileSystem {
|
|
|
|
kxio::fs::temp().unwrap_or_else(|e| {
|
2024-06-20 18:54:01 +01:00
|
|
|
println!("{e}");
|
2024-06-01 12:03:30 +01:00
|
|
|
panic!("fs")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn given_repo_details(forge_type: config::ForgeType) -> RepoDetails {
|
|
|
|
let fs = given_fs();
|
|
|
|
git::common::repo_details(
|
|
|
|
1,
|
2024-06-20 19:03:11 +01:00
|
|
|
git::Generation::default(),
|
2024-06-01 12:03:30 +01:00
|
|
|
config::common::forge_details(1, forge_type),
|
|
|
|
Some(config::common::repo_config(
|
|
|
|
1,
|
|
|
|
config::RepoConfigSource::Repo,
|
|
|
|
)),
|
2024-07-06 14:25:43 +01:00
|
|
|
config::GitDir::new(
|
|
|
|
fs.base().to_path_buf(),
|
|
|
|
config::git_dir::StoragePathType::Internal,
|
|
|
|
),
|
2024-06-01 12:03:30 +01:00
|
|
|
)
|
|
|
|
}
|