gitbutler/crates/gitbutler-branch/tests/virtual_branches/verify_branch.rs
Kiril Videlov 7d078de52f
start moving virtual_branches to separate crate
We want to move towards having each functional domain in a separate crate. 
The main benefit of that for our project is that this will enforce a unidirectional dependency graph (i.e. no cycles).
Starting off with virutal_branches - a lot of the implementation is still in core (i.e. virtual.rs), that will be moved in a separate PR. 

Furthermore, the virtual branches controller (as well as virtual.rs) contain functions not directly related to branches (e.g. commit reordering etc). That will be furthe separate in a crate.
2024-07-07 13:32:35 +02:00

23 lines
667 B
Rust

use super::*;
// Ensures that `verify_branch` returns an error when not on the integration branch.
#[tokio::test]
async fn should_fail_on_incorrect_branch() {
let Test {
repository,
project,
controller,
..
} = &Test::default();
let branch_name: git::LocalRefname = "refs/heads/somebranch".parse().unwrap();
repository.checkout(&branch_name);
let result = controller.list_virtual_branches(project).await;
let err = result.unwrap_err();
assert_eq!(
format!("{err:#}"),
"<verification-failed>: project is on refs/heads/somebranch. Please checkout gitbutler/integration to continue"
);
}