Skip to content

Commit

Permalink
🌱 Improve search commit e2e tests
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>
  • Loading branch information
naveensrinivasan committed Jul 21, 2023
1 parent 67e3f75 commit 9ceb440
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 9ceb440

Please sign in to comment.