2023-04-13 18:54:03 +02:00
|
|
|
import React from 'react';
|
2023-06-14 20:49:14 +02:00
|
|
|
import configureStore from '../../../store/store';
|
2023-04-13 18:54:03 +02:00
|
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
2023-06-14 20:49:14 +02:00
|
|
|
import mockState from '../../../../test/data/mock-state.json';
|
2023-05-08 19:32:39 +02:00
|
|
|
import { SEND_STAGES } from '../../../ducks/send';
|
2023-04-13 18:54:03 +02:00
|
|
|
import { AppHeader } from '.';
|
|
|
|
|
2023-06-14 20:49:14 +02:00
|
|
|
const render = (stateChanges = {}, location = jest.fn()) => {
|
|
|
|
const store = configureStore({
|
|
|
|
...mockState,
|
|
|
|
activeTab: {
|
|
|
|
origin: 'https://remix.ethereum.org',
|
|
|
|
},
|
|
|
|
...stateChanges,
|
|
|
|
});
|
|
|
|
return renderWithProvider(<AppHeader location={location} />, store);
|
|
|
|
};
|
|
|
|
|
2023-04-13 18:54:03 +02:00
|
|
|
describe('App Header', () => {
|
|
|
|
it('should match snapshot', () => {
|
2023-06-14 20:49:14 +02:00
|
|
|
const { container } = render();
|
2023-04-13 18:54:03 +02:00
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|
2023-06-14 20:49:14 +02:00
|
|
|
|
|
|
|
it('should disable the network picker during a send', () => {
|
|
|
|
const { getByTestId } = render({ send: { stage: SEND_STAGES.DRAFT } });
|
|
|
|
expect(getByTestId('network-display')).toBeDisabled();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should allow switching accounts during a send', () => {
|
|
|
|
const { getByTestId } = render({ send: { stage: SEND_STAGES.DRAFT } });
|
|
|
|
expect(getByTestId('account-menu-icon')).toBeEnabled();
|
|
|
|
});
|
2023-04-13 18:54:03 +02:00
|
|
|
});
|