Skip to content

Commit

Permalink
fix: test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
shane-t committed Dec 6, 2024
1 parent 53e0edc commit 5eef594
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5231,6 +5231,9 @@ describe('TransactionController', () => {
});

it.each([
{
newStatus: TransactionStatus.signed,
},
{
newStatus: TransactionStatus.submitted,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1963,14 +1963,14 @@ export class TransactionController extends BaseController<
status &&
![
TransactionStatus.submitted,
TransactionStatus.signed,
TransactionStatus.failed,
].includes(status)
) {
throw new Error(
`Cannot update custodial transaction with status: ${status}`,
);
}

const updatedTransactionMeta = merge(
{},
transactionMeta,
Expand Down
4 changes: 3 additions & 1 deletion packages/transaction-controller/src/api/accounts-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const CHAIN_ID_SUPPORTED = 1;
const CHAIN_ID_UNSUPPORTED = 999;
const FROM_ADDRESS = '0xSender';
const TO_ADDRESS = '0xRecipient';
const SORT_DIRECTION_MOCK = 'ASC';

const ACCOUNT_RESPONSE_MOCK = {
data: [{}],
Expand Down Expand Up @@ -132,13 +133,14 @@ describe('Accounts API', () => {
cursor: CURSOR_MOCK,
endTimestamp: END_TIMESTAMP_MOCK,
startTimestamp: START_TIMESTAMP_MOCK,
sortDirection: SORT_DIRECTION_MOCK,
});

expect(response).toStrictEqual(ACCOUNT_RESPONSE_MOCK);

expect(fetchMock).toHaveBeenCalledTimes(1);
expect(fetchMock).toHaveBeenCalledWith(
`https://accounts.api.cx.metamask.io/v1/accounts/${ADDRESS_MOCK}/transactions?networks=${CHAIN_IDS_MOCK[0]},${CHAIN_IDS_MOCK[1]}&startTimestamp=${START_TIMESTAMP_MOCK}&endTimestamp=${END_TIMESTAMP_MOCK}&cursor=${CURSOR_MOCK}`,
`https://accounts.api.cx.metamask.io/v1/accounts/${ADDRESS_MOCK}/transactions?networks=${CHAIN_IDS_MOCK[0]},${CHAIN_IDS_MOCK[1]}&startTimestamp=${START_TIMESTAMP_MOCK}&endTimestamp=${END_TIMESTAMP_MOCK}&cursor=${CURSOR_MOCK}&sortDirection=${SORT_DIRECTION_MOCK}`,
expect.any(Object),
);
});
Expand Down

0 comments on commit 5eef594

Please sign in to comment.