From 1ebad29137b42cbe62734effaf85196519c69705 Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Mon, 24 Dec 2018 11:04:17 +0000 Subject: [PATCH] Add additional tests to increase coverage (#29) --- migrations/github_test.go | 2 +- migrations/repo_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 migrations/repo_test.go diff --git a/migrations/github_test.go b/migrations/github_test.go index 17b8103..5568ec5 100644 --- a/migrations/github_test.go +++ b/migrations/github_test.go @@ -49,7 +49,7 @@ func TestFetchMigratory_FetchIssues(t *testing.T) { } func TestFetchMigratory_FetchComments(t *testing.T) { - comments, err := testFMig.FetchIssues() + comments, err := testFMig.FetchComments() assert.NoError(t, err) assert.True(t, len(comments) > 0, "at least one comment found") } diff --git a/migrations/repo_test.go b/migrations/repo_test.go new file mode 100644 index 0000000..b44b4b2 --- /dev/null +++ b/migrations/repo_test.go @@ -0,0 +1,25 @@ +package migrations + +import ( + "github.com/google/go-github/github" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestMigratory_Repository(t *testing.T) { + fm := &FetchMigratory{ + Migratory: *DemoMigratory, + GHClient: github.NewClient(nil), + RepoOwner: "JonasFranzDEV", + RepoName: "migrate", + } + ghRepo, _, err := fm.GHClient.Repositories.Get(fm.ctx(), fm.RepoOwner, fm.RepoName) + if err != nil { + t.Skipf("Skipped due to repo is not accessable: %v", err) + return + } + repo, err := fm.Repository(ghRepo) + assertNoError(t, err) + assert.Equal(t, "migrate", repo.Name) + assertNoError(t, fm.Client.DeleteRepo("demo", "migrate")) +}