9b360af2c1
* feat: add node url to footer, add link to change node * feat: add test for trading footer * chore: add comment about url manipulation * fix: #862 fix cypress tests * fix: #862 remove constant link Co-authored-by: Madalina Raicu <madalina@raygroup.uk>
27 lines
830 B
TypeScript
27 lines
830 B
TypeScript
import { fireEvent, render, screen } from '@testing-library/react';
|
|
import { Footer } from './footer';
|
|
import { useEnvironment } from '@vegaprotocol/environment';
|
|
|
|
jest.mock('@vegaprotocol/environment');
|
|
|
|
describe('Footer', () => {
|
|
it('renders a button to open node switcher', () => {
|
|
const mockOpenNodeSwitcher = jest.fn();
|
|
const node = 'n99.somenetwork.vega.xyz';
|
|
const nodeUrl = `https://${node}`;
|
|
|
|
// @ts-ignore mock env hook
|
|
useEnvironment.mockImplementation(() => ({
|
|
VEGA_URL: `https://api.${node}/graphql`,
|
|
setNodeSwitcherOpen: mockOpenNodeSwitcher,
|
|
}));
|
|
|
|
render(<Footer />);
|
|
|
|
fireEvent.click(screen.getByRole('button'));
|
|
expect(mockOpenNodeSwitcher).toHaveBeenCalled();
|
|
const link = screen.getByText(node);
|
|
expect(link).toHaveAttribute('href', nodeUrl);
|
|
});
|
|
});
|