mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-30 08:09:15 +01:00
880af262a4
* Add beta home banner to home screen * Move the beta home notification to the app-header * Updates to formatting * Add beta home banner to home screen * Move the beta home notification to the app-header * Updates to formatting * Update ui/components/app/app-header/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/app/app-header/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Update ui/components/app/app-header/index.scss Co-authored-by: George Marshall <george.marshall@consensys.net> * Move banner to top of page * Move to own folder, update styles * Swith to BOX component * Address feedback * Add tests * Update name of component * Fix tests * Fix proptype errors * Fixups * Remove unrelated changes * Remove unwanted string changes * Update beta component name and text * Update mock data Co-authored-by: George Marshall <george.marshall@consensys.net>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import { fireEvent } from '@testing-library/react';
|
|
import configureMockStore from 'redux-mock-store';
|
|
import thunk from 'redux-thunk';
|
|
import mockState from '../../../../test/data/mock-state.json';
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
|
import BetaHeader from '.';
|
|
|
|
const mockHideBetaHeader = jest.fn();
|
|
|
|
jest.mock('../../../store/actions', () => {
|
|
return {
|
|
hideBetaHeader: () => {
|
|
mockHideBetaHeader();
|
|
},
|
|
};
|
|
});
|
|
|
|
describe('Beta Header', () => {
|
|
let store;
|
|
|
|
beforeEach(() => {
|
|
store = configureMockStore([thunk])(mockState);
|
|
});
|
|
|
|
afterEach(() => {
|
|
mockHideBetaHeader.mockClear();
|
|
});
|
|
|
|
it('should match snapshot', () => {
|
|
const { container } = renderWithProvider(<BetaHeader />, store);
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
describe('Beta Header', () => {
|
|
it('gets hidden when close button is clicked', () => {
|
|
const { queryByTestId } = renderWithProvider(<BetaHeader />, store);
|
|
|
|
const closeButton = queryByTestId('beta-header-close');
|
|
fireEvent.click(closeButton);
|
|
|
|
expect(mockHideBetaHeader).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|
|
});
|