-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dda5198
commit a12ef9a
Showing
7 changed files
with
150 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Lint and Test before merging to main | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.50.1 | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: Build and Test | ||
run: | | ||
go get . | ||
go build -v ./... | ||
go test -v ./... | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package blink_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/rekram1-node/blinkgo/blink" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNewAccount(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
fakeEmail string | ||
fakePass string | ||
expectedAccount *blink.Account | ||
}{ | ||
{ | ||
name: "NewAccount: Good Call", | ||
fakeEmail: "example@example.com", | ||
fakePass: "fakepassword", | ||
expectedAccount: &blink.Account{ | ||
Email: "example@example.com", | ||
Password: "fakepassword", | ||
}, | ||
}, | ||
} | ||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
account := blink.NewAccount(test.fakeEmail, test.fakePass) | ||
assert.Equal(t, test.expectedAccount.Email, account.Email) | ||
assert.Equal(t, test.expectedAccount.Password, account.Password) | ||
assert.NotEqual(t, "", account.UniqueID) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package client_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-resty/resty/v2" | ||
"github.com/rekram1-node/blinkgo/internal/client" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestDefault(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
}{ | ||
{ | ||
name: "Default: Good Call", | ||
}, | ||
} | ||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
var c *resty.Client | ||
defaultClient := client.Default() | ||
assert.NotNil(t, defaultClient) | ||
assert.IsType(t, c, defaultClient) | ||
}) | ||
} | ||
} | ||
|
||
func TestNew(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
mockAuthToken string | ||
}{ | ||
{ | ||
name: "New: Good Call", | ||
mockAuthToken: "fake-token", | ||
}, | ||
} | ||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
var c *resty.Client | ||
newClient := client.New(test.mockAuthToken) | ||
assert.NotNil(t, newClient) | ||
assert.IsType(t, c, newClient) | ||
}) | ||
} | ||
} |