2022-02-22 21:58:21 +01:00
|
|
|
import React from 'react';
|
2022-04-19 17:08:09 +02:00
|
|
|
import { mount, shallow } from 'enzyme';
|
|
|
|
import { Provider } from 'react-redux';
|
2022-02-22 21:58:21 +01:00
|
|
|
import TextField from '../../components/ui/text-field';
|
2022-04-19 17:08:09 +02:00
|
|
|
import configureStore from '../../store/store';
|
2022-02-22 21:58:21 +01:00
|
|
|
import Settings from './settings.container';
|
|
|
|
import SettingsSearch from './settings-search';
|
|
|
|
|
|
|
|
describe('SettingsPage', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
|
|
|
const props = {
|
|
|
|
isAddressEntryPage: false,
|
|
|
|
backRoute: '/',
|
|
|
|
currentPath: '/settings',
|
|
|
|
location: '/settings',
|
|
|
|
mostRecentOverviewPage: '',
|
|
|
|
isPopup: false,
|
|
|
|
pathnameI18nKey: undefined,
|
|
|
|
addressName: '',
|
|
|
|
initialBreadCrumbRoute: undefined,
|
|
|
|
initialBreadCrumbKey: undefined,
|
|
|
|
addNewNetwork: false,
|
|
|
|
conversionDate: Date.now(),
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = shallow(<Settings.WrappedComponent {...props} />, {
|
|
|
|
context: {
|
|
|
|
t: (str) => str,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render title correctly', () => {
|
|
|
|
expect(
|
|
|
|
wrapper.find('.settings-page__header__title-container__title').text(),
|
|
|
|
).toStrictEqual('settings');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render search correctly', () => {
|
2022-04-19 17:08:09 +02:00
|
|
|
const store = configureStore({
|
|
|
|
metamask: {
|
|
|
|
snaps: {},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
wrapper = mount(
|
|
|
|
<Provider store={store}>
|
|
|
|
<SettingsSearch onSearch={() => undefined} settingsRoutesList={[]} />
|
|
|
|
</Provider>,
|
2022-02-22 21:58:21 +01:00
|
|
|
{
|
|
|
|
context: {
|
|
|
|
t: (s) => `${s}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper.find(TextField).props().id).toStrictEqual('search-settings');
|
|
|
|
expect(wrapper.find(TextField).props().value).toStrictEqual('');
|
|
|
|
});
|
|
|
|
});
|