mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 01:17:37 +03:00
test apply after update base
This commit is contained in:
parent
57ef71fd0c
commit
7c7fe88453
@ -1066,6 +1066,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nconflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1132,6 +1150,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nconflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1203,6 +1239,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nconflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1271,6 +1325,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap()); // TODO: should be true
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nfix conflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1339,6 +1411,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nfix conflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1407,6 +1497,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(!branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"second"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1489,6 +1597,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(!branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"second"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1604,6 +1730,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nconflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1665,6 +1809,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nconflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1731,6 +1893,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nconflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1794,6 +1974,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap()); // TODO: should be true
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nfix conflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1857,6 +2055,24 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap()); // TODO: should be true
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"<<<<<<< ours\nfix conflict\n=======\nsecond\n>>>>>>> theirs\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1920,6 +2136,28 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(!branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"second"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file2.txt")).unwrap(),
|
||||
"still no conflict"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@ -1998,6 +2236,28 @@ mod update_base_branch {
|
||||
.await
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
{
|
||||
// applying the branch should produce conflict markers
|
||||
controller
|
||||
.apply_virtual_branch(&project_id, &branch_id)
|
||||
.await
|
||||
.unwrap();
|
||||
let branches = controller.list_virtual_branches(&project_id).await.unwrap();
|
||||
assert_eq!(branches.len(), 1);
|
||||
assert_eq!(branches[0].id, branch_id);
|
||||
assert!(branches[0].active);
|
||||
assert!(!branches[0].conflicted);
|
||||
assert!(branches[0].base_current);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file.txt")).unwrap(),
|
||||
"second"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repository.path().join("file2.txt")).unwrap(),
|
||||
"other"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
Loading…
Reference in New Issue
Block a user