import configureStore from 'redux-mock-store';
import { AccountSettingsEditPage } from './settings-edit.page';
import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import { MemoryRouter } from 'react-router-dom';
import { Provider } from 'react-redux';

jest.mock('app/common/store', () => ({
  history: { push: () => {} },
}));

describe('Account edit settings page tests', () => {
  const initialState = {
    user: {
      current: {
        name: 'Test name',
      },
      data:{
        country: 'dk',
        countryCode: 'dk',
      },
    },
  };
  const mockStore = configureStore();
  let store;

  beforeEach(() => {
    store = mockStore(initialState);
  });

  it('renders page correctly', () => {
    const tree = ReactTestRenderer
      .create(
        <Provider store={store}>
          <MemoryRouter>
            <AccountSettingsEditPage/>
          </MemoryRouter>
        </Provider>
      )
      .toJSON();
    expect(tree).toMatchSnapshot();
  });
});
