option_service_test.go   A
last analyzed

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A afrikpay.TestOptionService_GetOptions 0 15 1
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