Skip to content

Commit

Permalink
Add basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mskutin committed Jul 10, 2020
1 parent a14e47a commit 18d9b6d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/github/client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package github

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestGithubTokenIsAbsent(t *testing.T) {
client, err := NewWithAuth("johndoe", "")
assert.Nil(t, client)
assert.Contains(t, err.Error(), "Github Token is required")
}
func TestGithubUsernameIsAbsent(t *testing.T) {
client, err := NewWithAuth("", "invalid")
assert.Nil(t, client)
assert.Contains(t, err.Error(), "Github username is required")
}
func TestGithubTokenValidity(t *testing.T) {
client, _ := NewWithAuth("johndoe", "invalid")
ok := client.IsTokenValid()
assert.False(t, ok)
}

0 comments on commit 18d9b6d

Please sign in to comment.