| Conditions | 1 | 
| Total Lines | 38 | 
| Code Lines | 26 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | package campay  | 
            ||
| 13 | func TestUtilitiesService_AirtimeTransferSync(t *testing.T) { | 
            ||
| 14 | // Setup  | 
            ||
| 15 | t.Parallel()  | 
            ||
| 16 | |||
| 17 | // Arrange  | 
            ||
| 18 | requests := make([]*http.Request, 0)  | 
            ||
| 19 | 	responses := [][]byte{stubs.PostTokenResponse(), stubs.PostTransferResponse(), stubs.GetPendingAirtimeTransactionResponse(), stubs.GetSuccessfullAirtimeTransactionResponse()} | 
            ||
| 20 | server := helpers.MakeRequestCapturingTestServer(http.StatusOK, responses, &requests)  | 
            ||
| 21 | client := New(WithEnvironment(Environment(server.URL)))  | 
            ||
| 22 | |||
| 23 | // Act  | 
            ||
| 24 | 	transaction, _, err := client.Utilities.AirtimeTransferSync(context.Background(), &AirtimeTransferParams{ | 
            ||
| 25 | Amount: "100",  | 
            ||
| 26 | To: "2376XXXXXXXXX",  | 
            ||
| 27 | ExternalReference: "5577006791947779410",  | 
            ||
| 28 | })  | 
            ||
| 29 | |||
| 30 | // Assert  | 
            ||
| 31 | assert.Nil(t, err)  | 
            ||
| 32 | |||
| 33 | assert.GreaterOrEqual(t, len(requests), 4)  | 
            ||
| 34 | 	assert.Equal(t, &UtilitiesTransaction{ | 
            ||
| 35 | Reference: "971e32ae-bb5a-420a-a38a-c2931536609f",  | 
            ||
| 36 | ExternalReference: "5577006791947779410",  | 
            ||
| 37 | Status: "SUCCESSFUL",  | 
            ||
| 38 | Amount: 100,  | 
            ||
| 39 | Currency: "XAF",  | 
            ||
| 40 | Operator: "ORANGE_CM",  | 
            ||
| 41 | Code: "CP220804U0649K",  | 
            ||
| 42 | Type: "AIRTIME",  | 
            ||
| 43 | Reason: "",  | 
            ||
| 44 | }, transaction)  | 
            ||
| 45 | |||
| 46 | assert.True(t, transaction.IsSuccessfull())  | 
            ||
| 47 | assert.False(t, transaction.IsPending())  | 
            ||
| 48 | |||
| 49 | // Teardown  | 
            ||
| 50 | server.Close()  | 
            ||
| 51 | }  | 
            ||
| 52 |