afrikpay.TestOptionService_GetOptions   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nop 1
dl 0
loc 15
rs 9.95
c 0
b 0
f 0
1
package afrikpay
2
3
import (
4
	"context"
5
	"net/http"
6
	"testing"
7
8
	"github.com/NdoleStudio/afrikpay-go/internal/helpers"
9
	"github.com/NdoleStudio/afrikpay-go/internal/stubs"
10
	"github.com/stretchr/testify/assert"
11
)
12
13
func TestOptionService_GetOptions(t *testing.T) {
14
	// Arrange
15
	apiKey := "test-api-key"
16
	server := helpers.MakeTestServer(http.StatusOK, stubs.CanalPlusOptionResponse())
17
	client := New(WithBaseURL(server.URL), WithAPIKey(apiKey))
18
19
	// Act
20
	options, response, err := client.CanalPlus.GetOptions(context.Background(), &CanalPlusOptionRequest{
21
		ReferenceNumber: "11111111111111",
22
	})
23
24
	// Assert
25
	assert.Nil(t, err)
26
	assert.Equal(t, http.StatusOK, response.HTTPResponse.StatusCode)
27
	assert.Equal(t, 6, len(options.Result))
28
}
29