Skip to content

Commit

Permalink
Add tests for the transaction history
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed Oct 15, 2022
1 parent ecce852 commit 4648c5c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,35 @@ func TestClient_Verify(t *testing.T) {
server.Close()
}

func TestClient_TransactionHistory(t *testing.T) {
// Setup
t.Parallel()

// Arrange
server := helpers.MakeTestServer(http.StatusOK, stubs.VerifyOk())
accessToken := "6B352110-4716-11ED-963F-0800200C9A66"
client := New(
WithBaseURL(server.URL),
WithAccessToken(accessToken),
WithAccessSecret("1B875FB0-4717-11ED-963F-0800200C9A66"),
)
paymentTransactionNumber := "99999166542651400095315364801168"

// Act
transactions, response, err := client.TransactionHistory(context.Background(), time.Now(), time.Now())

// Assert
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, response.HTTPResponse.StatusCode)
assert.Equal(t, 1, len(transactions))
assert.Equal(t, paymentTransactionNumber, transactions[0].PaymentTransactionNumber)
assert.False(t, transactions[0].IsFailed())
assert.Equal(t, "SUCCESS", transactions[0].Status)

// Teardown
server.Close()
}

func TestClient_VerifyEmpty(t *testing.T) {
// Setup
t.Parallel()
Expand Down

0 comments on commit 4648c5c

Please sign in to comment.