codex/broker-operations-ui #18
@ -222,7 +222,7 @@ describe('Broker pages', () => {
|
|||||||
expect(screen.getByText(/900,00/)).toBeInTheDocument();
|
expect(screen.getByText(/900,00/)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders broker operations with Russian labels, linked instruments and impact badges', () => {
|
it('renders broker operations with Russian labels, linked instruments and colored amounts', () => {
|
||||||
vi.spyOn(portfolioHook, 'useBrokerPortfolio').mockReturnValue({
|
vi.spyOn(portfolioHook, 'useBrokerPortfolio').mockReturnValue({
|
||||||
data: {
|
data: {
|
||||||
account: {
|
account: {
|
||||||
@ -311,8 +311,7 @@ describe('Broker pages', () => {
|
|||||||
|
|
||||||
expect(screen.getByText('Выплата купона')).toBeInTheDocument();
|
expect(screen.getByText('Выплата купона')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Налог')).toBeInTheDocument();
|
expect(screen.getByText('Налог')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Пополняет')).toBeInTheDocument();
|
expect(screen.getByText(/\+120,00\s*[₽Р]/)).toBeInTheDocument();
|
||||||
expect(screen.getByText('Списывает')).toBeInTheDocument();
|
|
||||||
expect(screen.getByRole('link', { name: 'SU26238RMFS5' })).toHaveAttribute(
|
expect(screen.getByRole('link', { name: 'SU26238RMFS5' })).toHaveAttribute(
|
||||||
'href',
|
'href',
|
||||||
'/bonds/SU26238RMFS5',
|
'/bonds/SU26238RMFS5',
|
||||||
@ -421,19 +420,26 @@ describe('Broker pages', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(operationsSpy).toHaveBeenLastCalledWith('acc-1', { limit: 10, cursor: undefined });
|
expect(operationsSpy).toHaveBeenLastCalledWith('acc-1', { limit: 10, cursor: undefined });
|
||||||
expect(screen.getByText('Страница 1')).toBeInTheDocument();
|
|
||||||
|
|
||||||
await user.click(screen.getByRole('button', { name: 'Вперед' }));
|
// Find pagination buttons by their text content (← and →)
|
||||||
|
const nextButton = screen.getByRole('button', { name: '→' });
|
||||||
|
const prevButton = screen.getByRole('button', { name: '←' });
|
||||||
|
expect(prevButton).toBeDisabled();
|
||||||
|
expect(nextButton).not.toBeDisabled();
|
||||||
|
|
||||||
|
await user.click(nextButton);
|
||||||
|
|
||||||
expect(operationsSpy).toHaveBeenLastCalledWith('acc-1', {
|
expect(operationsSpy).toHaveBeenLastCalledWith('acc-1', {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
cursor: 'cursor-page-2',
|
cursor: 'cursor-page-2',
|
||||||
});
|
});
|
||||||
expect(screen.getByText('Страница 2')).toBeInTheDocument();
|
|
||||||
|
|
||||||
await user.click(screen.getByRole('button', { name: 'Назад' }));
|
// Page number is shown as just a number (without "Страница" label)
|
||||||
|
expect(screen.getByText('2')).toBeInTheDocument();
|
||||||
|
|
||||||
|
await user.click(screen.getByRole('button', { name: '←' }));
|
||||||
|
|
||||||
expect(operationsSpy).toHaveBeenLastCalledWith('acc-1', { limit: 10, cursor: undefined });
|
expect(operationsSpy).toHaveBeenLastCalledWith('acc-1', { limit: 10, cursor: undefined });
|
||||||
expect(screen.getByText('Страница 1')).toBeInTheDocument();
|
expect(screen.getByText('1')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user