Skip to content

Commit

Permalink
GitOpsTest: use an explicit default branch
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jan 18, 2023
1 parent 065f6a4 commit 15e81f1
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ class GitOpsTest extends FunSuite {
add(f1)
add(f2)
commit
assertEquals(diff("master").toSet, Set(f1, f2))
assertEquals(diff("master", dir).toSet, Set(f2))
assertEquals(diff(defaultBranch).toSet, Set(f1, f2))
assertEquals(diff(defaultBranch, dir).toSet, Set(f2))
}

test(
Expand All @@ -249,8 +249,8 @@ class GitOpsTest extends FunSuite {
add(f1)
add(f2)
modify(f1)
assertEquals(diff("master").toSet, Set(f1, f2))
assertEquals(diff("master", dir).toSet, Set(f2))
assertEquals(diff(defaultBranch).toSet, Set(f1, f2))
assertEquals(diff(defaultBranch, dir).toSet, Set(f2))
}

test("diff should not return removed files against a different branch") {
Expand All @@ -264,7 +264,7 @@ class GitOpsTest extends FunSuite {
add(f2)
commit
rm(f1)
assertEquals(diff("master").toSet, Set(f2))
assertEquals(diff(defaultBranch).toSet, Set(f2))
}

test("status should return only modified files") {
Expand Down Expand Up @@ -338,6 +338,8 @@ class GitOpsTest extends FunSuite {

private object GitOpsTest {

private final val defaultBranch = "main"

// Filesystem commands
def rmfs(file: AbsoluteFile): Unit =
file.delete()
Expand All @@ -353,7 +355,7 @@ private object GitOpsTest {
}

def init(implicit ops: GitOpsImpl): Unit =
git("init")
git("init", "-b", defaultBranch)

def add(file: AbsoluteFile*)(implicit ops: GitOpsImpl): Unit =
git("add", file.map(_.toString()): _*)
Expand Down

0 comments on commit 15e81f1

Please sign in to comment.