Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Oren committed Jan 16, 2023
1 parent 28bc99c commit 208489b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,39 @@ func TestClient_GeneralTests(t *testing.T) {
t.Error("expected do request to return error")
}
}

func TestClient_GetEnvironment(t *testing.T) {
type fields struct {
ctx context.Context
client *http.Client
config Config
RetryTimout time.Duration
RetryWait time.Duration
services services
}
tests := []struct {
name string
fields fields
want common.Environment
}{
{"ok 1", fields{config: Config{Environment: ""}}, common.ENV_PROD},
{"ok 1", fields{config: Config{Environment: "dev"}}, common.ENV_DEV},
{"ok 1", fields{config: Config{Environment: "qa"}}, common.ENV_QA},
{"ok 1", fields{config: Config{Environment: "prod"}}, common.ENV_PROD},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &Client{
ctx: tt.fields.ctx,
client: tt.fields.client,
config: tt.fields.config,
RetryTimout: tt.fields.RetryTimout,
RetryWait: tt.fields.RetryWait,
services: tt.fields.services,
}
if got := c.GetEnvironment(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Client.GetEnvironment() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit 208489b

Please sign in to comment.