Skip to content

Commit

Permalink
Add test and README mention on getTransactionsByMonth
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymholt committed Jul 11, 2024
1 parent 9f9ad81 commit b738fb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ The following methods are available in this library.
| **Transactions** | [transactions.getTransactions(budget_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns budget transactions |
| | [transactions.getTransactionsByAccount(budget_id, account_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified account |
| | [transactions.getTransactionsByCategory(budget_id, category_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified category |
| | [transactions.getTransactionsByMonth(budget_id, month)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified month |
| | [transactions.getTransactionsByType(budget_id, type)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions of a specified type ("unapproved" or "uncategorized") |
| | [transactions.getTransactionById(budget_id, transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns a single transaction |
| | [transactions.createTransaction(budget_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Creates a single transaction |
Expand Down
16 changes: 16 additions & 0 deletions test/requestTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,22 @@ describe("API requests", () => {
);
});

it("Should getTransactionsByMonth and validate the request is sent correctly", async () => {
const ynabAPI = new ynab.API(API_KEY, BASE_URL);

const month = "2024-07-01";
await callApiAndVerifyResponse(
() =>
ynabAPI.transactions.getTransactionsByMonth(
budgetId, month
),
factories.hybridtransactionsResponseFactory.build()
);
verifyRequestDetails(
`${BASE_URL}/budgets/${budgetId}/months/${month}/transactions`
);
});

it("Should getTransactionsByCategory with a string `sinceDate` and validate the request is sent correctly", async () => {
const ynabAPI = new ynab.API(API_KEY, BASE_URL);

Expand Down

0 comments on commit b738fb8

Please sign in to comment.