forked from plaid/plaid-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvestment_transactions_test.go
More file actions
29 lines (24 loc) · 1018 Bytes
/
Copy pathinvestment_transactions_test.go
File metadata and controls
29 lines (24 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package tests
import (
"context"
"testing"
"time"
"github.com/plaid/plaid-go/v31/plaid"
"github.com/stretchr/testify/assert"
)
func TestInvestmentsTransactionsGet(t *testing.T) {
testClient := NewTestClient()
ctx := context.Background()
accessToken := createSandboxItem(t, ctx, testClient, FIRST_PLATYPUS_BANK, []plaid.Products{plaid.PRODUCTS_INVESTMENTS})
startDateString := time.Now().Add(-365 * 24 * time.Hour).Format(iso8601TimeFormat)
endDateString := time.Now().Format(iso8601TimeFormat)
request := plaid.NewInvestmentsTransactionsGetRequest(accessToken, startDateString, endDateString)
response, _, err := testClient.PlaidApi.InvestmentsTransactionsGet(ctx).InvestmentsTransactionsGetRequest(*request).Execute()
assert.NoError(t, err)
assert.NotEmpty(t, response.GetAccounts())
assert.NotEmpty(t, response.GetInvestmentTransactions())
for _, transaction := range response.InvestmentTransactions {
assert.NotEmpty(t, transaction.Subtype)
}
assert.NotEmpty(t, response.GetSecurities())
}