Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard: Update tests to use new renderWithProviders test util #4427

Merged
merged 26 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ea711a9
initial find and replace of renderWithProviders
dmmulroy Sep 9, 2020
b602f2c
update storiesView from renderWithThemeAndFlagsProvider
dmmulroy Sep 9, 2020
6bc99a8
Delete renderWithTheme
dmmulroy Sep 9, 2020
ea17682
Update renderWithProviders to accept MockApiProvider overrides
dmmulroy Sep 9, 2020
47f7369
Update tests to use new renderWithgProviders
dmmulroy Sep 9, 2020
d5c7e67
Refactor editorSettings tests to remove test wrapper component and us…
dmmulroy Sep 9, 2020
7adcce4
Update googleAnalytics to use renderWithProviders
dmmulroy Sep 9, 2020
9e871c9
Update publisherLogo to use renderWithProviders
dmmulroy Sep 9, 2020
083c502
update telemetrySettings to use renderWithProviders
dmmulroy Sep 9, 2020
6c8be6c
update content to use renderWithProviders
dmmulroy Sep 9, 2020
bb31577
update emptyView to use renderWithProviders
dmmulroy Sep 9, 2020
ccab305
update telemetryBanner to use renderWithProviders
dmmulroy Sep 9, 2020
b06f2d2
update alert to use renderWithProviders
dmmulroy Sep 9, 2020
2065b3e
update bookmark-chip to use renderWithProviders
dmmulroy Sep 9, 2020
42ebe2e
update button to use renderWithProviders
dmmulroy Sep 9, 2020
005209c
update card tests to use renderWithProviders
dmmulroy Sep 9, 2020
a267886
update templateNavBar to use renderWithProviders
dmmulroy Sep 9, 2020
4bd39ee
update dialog to use renderWithProviders
dmmulroy Sep 9, 2020
bacf3ad
update dropbown to use renderWithProviders
dmmulroy Sep 9, 2020
00ee169
update remaining tests to use renderWithProviders
dmmulroy Sep 9, 2020
578bbe9
Update test util imports/exports
dmmulroy Sep 9, 2020
52aad9a
update renderWithProviders to use wrapper render options for rerender…
dmmulroy Sep 9, 2020
ed068b7
Remove unneeded rerender
dmmulroy Sep 9, 2020
3af71f9
Merge branch 'main' into task/update-tests
dmmulroy Sep 10, 2020
7c7c2a0
Merge branch 'main' into task/update-tests
dmmulroy Sep 11, 2020
b77ac38
Revert Lint
carloskelly13 Sep 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { fireEvent } from '@testing-library/react';
/**
* Internal dependencies
*/
import { renderWithTheme } from '../../../../../testUtils';
import { renderWithProviders } from '../../../../../testUtils';
import GoogleAnalyticsSettings, { TEXT } from '../';

describe('Editor Settings: Google Analytics <GoogleAnalytics />', function () {
Expand All @@ -40,7 +40,7 @@ describe('Editor Settings: Google Analytics <GoogleAnalytics />', function () {
});

it('should render google analytics input and helper text by default', function () {
const { getByRole, getByText } = renderWithTheme(
const { getByRole, getByText } = renderWithProviders(
<GoogleAnalyticsSettings
googleAnalyticsId={googleAnalyticsId}
handleUpdate={mockUpdate}
Expand All @@ -55,7 +55,7 @@ describe('Editor Settings: Google Analytics <GoogleAnalytics />', function () {
});

it('should call mockUpdate when enter is keyed on input', function () {
let { getByRole, rerender } = renderWithTheme(
let { getByRole, rerender } = renderWithProviders(
<GoogleAnalyticsSettings
googleAnalyticsId={googleAnalyticsId}
handleUpdate={mockUpdate}
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('Editor Settings: Google Analytics <GoogleAnalytics />', function () {
});

it('should call mockUpdate when the save button is clicked', function () {
const { getByRole, rerender } = renderWithTheme(
const { getByRole, rerender } = renderWithProviders(
<GoogleAnalyticsSettings
googleAnalyticsId={googleAnalyticsId}
handleUpdate={mockUpdate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { fireEvent, within } from '@testing-library/react';
/**
* Internal dependencies
*/
import { renderWithTheme } from '../../../../../testUtils';
import { renderWithProviders } from '../../../../../testUtils';

import PublisherLogoSettings, { TEXT } from '..';
import formattedPublisherLogos from '../../../../../dataUtils/formattedPublisherLogos';
Expand All @@ -31,7 +31,7 @@ describe('PublisherLogo', () => {
const mockHandleAddLogos = jest.fn();

it('should render a fileUpload container and helper text by default when canUploadFiles is true', () => {
const { getByTestId, getByText } = renderWithTheme(
const { getByTestId, getByText } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand All @@ -47,7 +47,7 @@ describe('PublisherLogo', () => {
});

it('should not render fileUpload container when canUploadFiles is false', () => {
const { queryAllByTestId } = renderWithTheme(
const { queryAllByTestId } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand All @@ -61,7 +61,7 @@ describe('PublisherLogo', () => {
});

it('should render an image for each publisherLogo in the array', () => {
const { queryAllByRole } = renderWithTheme(
const { queryAllByRole } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand All @@ -75,7 +75,7 @@ describe('PublisherLogo', () => {
});

it('should specify the first logo displayed as default', () => {
const { queryAllByRole } = renderWithTheme(
const { queryAllByRole } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand All @@ -92,7 +92,7 @@ describe('PublisherLogo', () => {
});

it('should render a context menu button for each uploaded logo', () => {
const { queryAllByTestId } = renderWithTheme(
const { queryAllByTestId } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand All @@ -108,7 +108,7 @@ describe('PublisherLogo', () => {
});

it('should render an error message if uploadError is present', () => {
const { getByText } = renderWithTheme(
const { getByText } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand All @@ -126,7 +126,7 @@ describe('PublisherLogo', () => {
it('should trigger mockHandleRemoveLogo when delete button is pressed with enter on an uploaded file', () => {
const mockHandleRemoveLogo = jest.fn();

const { getByTestId } = renderWithTheme(
const { getByTestId } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={jest.fn}
handleRemoveLogo={mockHandleRemoveLogo}
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('PublisherLogo', () => {
it('should trigger mockHandleRemoveLogo when delete button is clicked on an uploaded file', () => {
const mockHandleRemoveLogo = jest.fn();

const { getByTestId } = renderWithTheme(
const { getByTestId } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={mockHandleRemoveLogo}
Expand All @@ -182,7 +182,7 @@ describe('PublisherLogo', () => {
it('should trigger mockHandleUpdateDefaultLogo when update default logo button is clicked on an uploaded file', () => {
const mockHandleDefaultLogo = jest.fn();

const { getByTestId } = renderWithTheme(
const { getByTestId } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand All @@ -207,7 +207,7 @@ describe('PublisherLogo', () => {

it('should trigger mockHandleUpdateDefaultLogo when update default logo button is pressed with enter on an uploaded file', () => {
const mockHandleDefaultLogo = jest.fn();
const { getByTestId } = renderWithTheme(
const { getByTestId } = renderWithProviders(
<PublisherLogoSettings
handleAddLogos={mockHandleAddLogos}
handleRemoveLogo={jest.fn}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import { fireEvent } from '@testing-library/react';
/**
* Internal dependencies
*/
import { renderWithTheme } from '../../../../../testUtils';
import { renderWithProviders } from '../../../../../testUtils';
import TelemetrySettings from '../index';

describe('Editor Settings: <TelemetrySettings />', function () {
it('should render the telemetry as checked when selected is true.', function () {
const { getByRole } = renderWithTheme(
const { getByRole } = renderWithProviders(
<TelemetrySettings
disabled={false}
onCheckboxSelected={jest.fn()}
Expand All @@ -39,7 +39,7 @@ describe('Editor Settings: <TelemetrySettings />', function () {
});

it('should render the telemetry as not checked when selected is false.', function () {
const { getByRole } = renderWithTheme(
const { getByRole } = renderWithProviders(
<TelemetrySettings
disabled={false}
onCheckboxSelected={jest.fn()}
Expand All @@ -52,7 +52,7 @@ describe('Editor Settings: <TelemetrySettings />', function () {

it('should call the change function when the checkbox is clicked.', function () {
const changeFn = jest.fn();
const { getByRole } = renderWithTheme(
const { getByRole } = renderWithProviders(
<TelemetrySettings
disabled={false}
onCheckboxSelected={changeFn}
Expand Down