0.0.2-alpha.3
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/knowledge-git-api/unit_tests/lib.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
struct FakeGitError;
|
||||
@@ -16,6 +16,10 @@ impl crate::GitRepository for FakeGitRepository {
|
||||
fn resolve_revision(&self, source_id: &knowledge_domain_lib::SourceId, reference: &crate::GitReference) -> Result<crate::GitRevision, Self::Error> {
|
||||
return Ok(crate::GitRevision::new(&format!("{}:{}", source_id.as_str(), reference.as_str())));
|
||||
}
|
||||
|
||||
fn prepare_snapshot(&self, _source_id: &knowledge_domain_lib::SourceId, revision: &crate::GitRevision) -> Result<crate::GitSnapshot, Self::Error> {
|
||||
return Ok(crate::GitSnapshot::new(revision.clone(), std::path::PathBuf::from("/controlled/snapshot")));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -31,5 +35,14 @@ fn generic_repository_contract_does_not_require_a_forge() {
|
||||
assert!(crate::GitRepository::refresh(&mut repository, &source_id).is_ok());
|
||||
let revision_result = crate::GitRepository::resolve_revision(&repository, &source_id, &reference);
|
||||
assert_eq!(revision_result, Ok(crate::GitRevision::new("local-pgr:refs/heads/master")));
|
||||
let revision = match revision_result {
|
||||
Ok(value) => value,
|
||||
Err(_) => return,
|
||||
};
|
||||
let snapshot_result = crate::GitRepository::prepare_snapshot(&repository, &source_id, &revision);
|
||||
assert_eq!(
|
||||
snapshot_result,
|
||||
Ok(crate::GitSnapshot::new(revision, std::path::PathBuf::from("/controlled/snapshot")))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user