Browse Source

Add additional tests to increase coverage (#29)

pull/31/head
Jonas Franz 3 months ago
parent
commit
1ebad29137
2 changed files with 26 additions and 1 deletions
  1. 1
    1
      migrations/github_test.go
  2. 25
    0
      migrations/repo_test.go

+ 1
- 1
migrations/github_test.go View File

@@ -49,7 +49,7 @@ func TestFetchMigratory_FetchIssues(t *testing.T) {
49 49
 }
50 50
 
51 51
 func TestFetchMigratory_FetchComments(t *testing.T) {
52
-	comments, err := testFMig.FetchIssues()
52
+	comments, err := testFMig.FetchComments()
53 53
 	assert.NoError(t, err)
54 54
 	assert.True(t, len(comments) > 0, "at least one comment found")
55 55
 }

+ 25
- 0
migrations/repo_test.go View File

@@ -0,0 +1,25 @@
1
+package migrations
2
+
3
+import (
4
+	"github.com/google/go-github/github"
5
+	"github.com/stretchr/testify/assert"
6
+	"testing"
7
+)
8
+
9
+func TestMigratory_Repository(t *testing.T) {
10
+	fm := &FetchMigratory{
11
+		Migratory: *DemoMigratory,
12
+		GHClient:  github.NewClient(nil),
13
+		RepoOwner: "JonasFranzDEV",
14
+		RepoName:  "migrate",
15
+	}
16
+	ghRepo, _, err := fm.GHClient.Repositories.Get(fm.ctx(), fm.RepoOwner, fm.RepoName)
17
+	if err != nil {
18
+		t.Skipf("Skipped due to repo is not accessable: %v", err)
19
+		return
20
+	}
21
+	repo, err := fm.Repository(ghRepo)
22
+	assertNoError(t, err)
23
+	assert.Equal(t, "migrate", repo.Name)
24
+	assertNoError(t, fm.Client.DeleteRepo("demo", "migrate"))
25
+}

Loading…
Cancel
Save