mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 12:56:01 +01:00
308c6e4fe3
* add snaps view search * add snaps view search * fix to add in settings constants * removed spread * remove unused import * add fencing * more fencing * ternary refactor, updated settings tests * refactor
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import { mount, shallow } from 'enzyme';
|
|
import { Provider } from 'react-redux';
|
|
import TextField from '../../components/ui/text-field';
|
|
import configureStore from '../../store/store';
|
|
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', () => {
|
|
const store = configureStore({
|
|
metamask: {
|
|
snaps: {},
|
|
},
|
|
});
|
|
wrapper = mount(
|
|
<Provider store={store}>
|
|
<SettingsSearch onSearch={() => undefined} settingsRoutesList={[]} />
|
|
</Provider>,
|
|
{
|
|
context: {
|
|
t: (s) => `${s}`,
|
|
},
|
|
},
|
|
);
|
|
|
|
expect(wrapper.find(TextField).props().id).toStrictEqual('search-settings');
|
|
expect(wrapper.find(TextField).props().value).toStrictEqual('');
|
|
});
|
|
});
|