From 9ceb440608484ce67414317c0e319e36dc5b8f20 Mon Sep 17 00:00:00 2001 From: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com> Date: Fri, 21 Jul 2023 16:03:02 -0500 Subject: [PATCH] :seedling: Improve search commit e2e tests - 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> --- e2e/searchCommits_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/e2e/searchCommits_test.go b/e2e/searchCommits_test.go index 1d8d8c419f0b..db6e42c3b17e 100644 --- a/e2e/searchCommits_test.go +++ b/e2e/searchCommits_test.go @@ -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()) + }) }) })