| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 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 |