Skip to content

Commit

Permalink
🌱 Improve search commit e2e tests (ossf#3295)
Browse files Browse the repository at this point in the history
- Add 2 tests for searching commits in e2e/searchCommits_test.go
- Fix errors in e2e/searchCommits_test.go when not using HEAD or when user does not exist

[e2e/searchCommits_test.go]
- Add 2 tests for searching commits
- Fix error when not using HEAD
- Fix error when user does not exist

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
  • Loading branch information
naveensrinivasan authored and ashearin committed Nov 13, 2023
1 parent d9a0624 commit 8c68b00
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions e2e/searchCommits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,21 @@ var _ = Describe("E2E TEST:SearchCommits", func() {
Expect(err).Should(BeNil())
Expect(len(commits)).Should(BeNumerically(">", 0))
})
It("Should return error as it is not using HEAD", func() {
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
Expect(err).Should(BeNil())
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
err = repoClient.InitRepo(repo, "123456789", 0)
Expect(err).ShouldNot(Not(BeNil()))
})
It("Should return error as the user does not exists", func() {
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
Expect(err).Should(BeNil())
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
err = repoClient.InitRepo(repo, clients.HeadSHA, 0)
Expect(err).Should(BeNil())
_, err = repoClient.SearchCommits(clients.SearchCommitsOptions{Author: "thisuserdoesnotexists"})
Expect(err).ShouldNot(BeNil())
})
})
})

0 comments on commit 8c68b00

Please sign in to comment.