Skip to content

Commit

Permalink
[patch] adding another contribution test to verify a case i was conce…
Browse files Browse the repository at this point in the history
…rned about
  • Loading branch information
robertfmurdock committed Aug 10, 2024
1 parent e53f499 commit 93f597e
Showing 1 changed file with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,49 @@ interface CurrentContributionTestSpec : SetupWithOverrides {

val merge2Commit = grgit.mergeInBranch("branch1", "merge2")
delayLongEnoughToAffectGitDate()
val thirdRelease = grgit.addTag("release3")
val secondRelease = grgit.addTag("release2")

val allOutput = runCurrentContributionData()
assertEquals(
toContribution(
lastCommit = merge2Commit,
firstCommit = secondCommit,
expectedCommitCount = 7,
tag = secondRelease,
expectedAuthors = defaultAuthors,
),
parseContribution(allOutput),
)
}

@Test
fun `will correctly understand longer running branch`() {
setupWithDefaults()
val grgit = initializeGitRepo(listOf("first"))
grgit.head()

grgit.addTag("release")
grgit.switchToNewBranch("branch")
val secondCommit = grgit.addCommitWithMessage("second")
grgit.checkout { it.branch = "main" }
grgit.addCommitWithMessage("third")
delayLongEnoughToAffectGitDate()
grgit.addTag("release2")
grgit.checkout { it.branch = "branch" }
grgit.addCommitWithMessage("fourth")
grgit.addCommitWithMessage("fifth")
grgit.checkout { it.branch = "main" }
grgit.mergeInBranch("branch", "merge")
val lastCommit = grgit.addCommitWithMessage("sixth")
delayLongEnoughToAffectGitDate()
val thirdRelease = grgit.addTag("release3")

val allOutput = runCurrentContributionData()
assertEquals(
toContribution(
lastCommit = lastCommit,
firstCommit = secondCommit,
expectedCommitCount = 5,
tag = thirdRelease,
expectedAuthors = defaultAuthors,
),
Expand Down

0 comments on commit 93f597e

Please sign in to comment.