Skip to content

Commit

Permalink
fix: only request committed transactions for spent table (#1095)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz authored Nov 20, 2023
1 parent bd8455b commit 461ccc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/data/services/EnterpriseSubsidyApiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SubsidyApiService {

static fetchCustomerTransactions(subsidyUuid, options = {}) {
const queryParams = new URLSearchParams({
state: 'committed',
...snakeCaseObject(options),
});
const url = `${SubsidyApiService.baseUrlV2}/subsidies/${subsidyUuid}/admin/transactions/?${queryParams.toString()}`;
Expand Down
4 changes: 3 additions & 1 deletion src/data/services/tests/EnterpriseSubsidyApiService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ describe('EnterpriseSubsidyApiService', () => {
beforeEach(() => {
jest.clearAllMocks();
});

test('fetchCustomerTransactions calls the API to fetch transactions by enterprise subsidy', () => {
const mockSubsidyUUID = 'test-subsidy-uuid';
const expectedUrl = `${SubsidyApiService.baseUrlV2}/subsidies/${mockSubsidyUUID}/admin/transactions/?`;
const expectedUrl = `${SubsidyApiService.baseUrlV2}/subsidies/${mockSubsidyUUID}/admin/transactions/?state=committed`;
SubsidyApiService.fetchCustomerTransactions(mockSubsidyUUID);
expect(axios.get).toBeCalledWith(expectedUrl);
});

test('getSubsidyByCustomerUUID calls the API to fetch subsides by enterprise customer UUID', () => {
const mockCustomerUUID = 'test-customer-uuid';
const expectedUrl = `${SubsidyApiService.baseUrlV1}/subsidies/?enterprise_customer_uuid=${mockCustomerUUID}`;
Expand Down

0 comments on commit 461ccc7

Please sign in to comment.