diff --git a/ui/pages/onboarding-flow/onboarding-app-header/__snapshots__/onboarding-app-header.test.js.snap b/ui/pages/onboarding-flow/onboarding-app-header/__snapshots__/onboarding-app-header.test.js.snap new file mode 100644 index 000000000000..c024c8317610 --- /dev/null +++ b/ui/pages/onboarding-flow/onboarding-app-header/__snapshots__/onboarding-app-header.test.js.snap @@ -0,0 +1,223 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`OnboardingAppHeader should match snapshot 1`] = ` +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+`; diff --git a/ui/pages/onboarding-flow/onboarding-app-header/onboarding-app-header.test.js b/ui/pages/onboarding-flow/onboarding-app-header/onboarding-app-header.test.js new file mode 100644 index 000000000000..93d68478c57f --- /dev/null +++ b/ui/pages/onboarding-flow/onboarding-app-header/onboarding-app-header.test.js @@ -0,0 +1,41 @@ +import { fireEvent } from '@testing-library/react'; +import React from 'react'; +import configureMockStore from 'redux-mock-store'; +import thunk from 'redux-thunk'; +import { renderWithProvider } from '../../../../test/lib/render-helpers'; +import OnboardingAppHeader from './onboarding-app-header'; + +const mockUpdateCurrentLocale = jest.fn(); + +jest.mock('../../../../app/_locales/index.json', () => { + return [{ code: 'en', name: 'English' }]; +}); + +jest.mock('../../../store/actions.ts', () => ({ + updateCurrentLocale: () => mockUpdateCurrentLocale, +})); + +describe('OnboardingAppHeader', () => { + const mockState = { + localeMessages: { + currentLocale: 'en', + }, + }; + + const store = configureMockStore([thunk])(mockState); + + it('should match snapshot', () => { + const { container } = renderWithProvider(, store); + + expect(container).toMatchSnapshot(); + }); + + it('should call updateCurrentLocale action', () => { + const { getByRole } = renderWithProvider(, store); + + const selectCombobox = getByRole('combobox'); + fireEvent.change(selectCombobox); + + expect(mockUpdateCurrentLocale).toHaveBeenCalled(); + }); +});