Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions tests/unit/hooks/useSelectedTransactionsActions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,15 @@ describe('useSelectedTransactionsActions', () => {
}),
);

// Wait specifically for the MOVE option to appear, not just any options.
// The EXPORT option appears immediately, but MOVE depends on selectedTransactionsList
// which requires the Onyx transaction data to be fully loaded.
await waitFor(() => {
expect(result.current.options.length).toBeGreaterThan(0);
const moveOption = result.current.options.find((option) => option.value === 'MOVE');
expect(moveOption).toBeDefined();
});

const moveOption = result.current.options.find((option) => option.value === 'MOVE');
expect(moveOption).toBeDefined();
expect(moveOption?.text).toBe('iou.moveExpenses');
});

Expand Down Expand Up @@ -626,12 +629,15 @@ describe('useSelectedTransactionsActions', () => {
}),
);

// Wait specifically for the SPLIT option to appear, not just any options.
// The EXPORT option appears immediately, but SPLIT depends on selectedTransactionsList
// which requires the Onyx transaction data to be fully loaded.
await waitFor(() => {
expect(result.current.options.length).toBeGreaterThan(0);
const splitOption = result.current.options.find((option) => option.value === 'SPLIT');
expect(splitOption).toBeDefined();
});

const splitOption = result.current.options.find((option) => option.value === 'SPLIT');
expect(splitOption).toBeDefined();
expect(splitOption?.text).toBe('iou.split');

splitOption?.onSelected?.();
Expand Down Expand Up @@ -670,12 +676,15 @@ describe('useSelectedTransactionsActions', () => {
}),
);

// Wait specifically for the MERGE option to appear, not just any options.
// The EXPORT option appears immediately, but MERGE depends on selectedTransactionsList
// which requires the Onyx transaction data to be fully loaded.
await waitFor(() => {
expect(result.current.options.length).toBeGreaterThan(0);
const mergeOption = result.current.options.find((option) => option.value === 'MERGE');
expect(mergeOption).toBeDefined();
});

const mergeOption = result.current.options.find((option) => option.value === 'MERGE');
expect(mergeOption).toBeDefined();
expect(mergeOption?.text).toBe('common.merge');

mergeOption?.onSelected?.();
Expand Down
Loading