test/wizard/azure: avoid scalprum errors

Avoid having to deal with scalprum errors by not rendering the
LandingPage.
This commit is contained in:
Thomas Lavocat 2023-08-08 15:25:06 +02:00 committed by Thomas Lavocat
parent baefa79bb8
commit 697d0af4b5
2 changed files with 39 additions and 10 deletions

View file

@ -1,14 +1,29 @@
import React from 'react';
import '@testing-library/jest-dom';
import { screen } from '@testing-library/react';
import { rest } from 'msw';
import CreateImageWizard from '../../../Components/CreateImageWizard/CreateImageWizard';
import ShareImageModal from '../../../Components/ShareImageModal/ShareImageModal';
import { PROVISIONING_API } from '../../../constants.js';
import { server } from '../../mocks/server.js';
import {
clickNext,
renderWithReduxRouter,
} from '../../testUtils';
import { clickNext, renderCustomRoutesWithReduxRouter } from '../../testUtils';
const routes = [
{
path: 'insights/image-builder/*',
element: <div />,
},
{
path: 'insights/image-builder/imagewizard/:composeId?',
element: <CreateImageWizard />,
},
{
path: 'insights/image-builder/share/:composeId',
element: <ShareImageModal />,
},
];
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
useChrome: () => ({
@ -40,7 +55,7 @@ describe('Step Upload to Azure', () => {
});
const setUp = async () => {
renderWithReduxRouter('imagewizard', {});
renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
// select aws as upload destination
const azureTile = screen.getByTestId('upload-azure');
azureTile.click();

View file

@ -1,17 +1,31 @@
import React from 'react';
import '@testing-library/jest-dom';
import { screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { rest } from 'msw';
import { PROVISIONING_API } from '../../../constants.js';
import { server } from '../../mocks/server.js';
import CreateImageWizard from '../../../Components/CreateImageWizard/CreateImageWizard';
import ShareImageModal from '../../../Components/ShareImageModal/ShareImageModal';
import {
clickNext,
getNextButton,
renderWithReduxRouter,
renderCustomRoutesWithReduxRouter,
} from '../../testUtils';
const routes = [
{
path: 'insights/image-builder/*',
element: <div />,
},
{
path: 'insights/image-builder/imagewizard/:composeId?',
element: <CreateImageWizard />,
},
{
path: 'insights/image-builder/share/:composeId',
element: <ShareImageModal />,
},
];
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
useChrome: () => ({
auth: {
@ -53,7 +67,7 @@ describe('Step Upload to Azure', () => {
const user = userEvent.setup();
const setUp = async () => {
renderWithReduxRouter('imagewizard', {});
renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
// select aws as upload destination
const azureTile = screen.getByTestId('upload-azure');
azureTile.click();