test: Update test files to work with Vitest
This updates the files to be compatible with Vitest. Changes include: - adding `@testing-library/jest-dom` import to enable custom jest matchers - renaming `jest.` to `vi.` - setting flags to false as default where needed
This commit is contained in:
parent
da16a42128
commit
2a48966bba
23 changed files with 196 additions and 63 deletions
|
|
@ -3,11 +3,14 @@ import React from 'react';
|
|||
import '@testing-library/jest-dom';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import nodeFetch, { Request, Response } from 'node-fetch';
|
||||
|
||||
import ShareImageModal from '../../../Components/ShareImageModal/ShareImageModal';
|
||||
import { renderCustomRoutesWithReduxRouter } from '../../testUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
Object.assign(global, { fetch: nodeFetch, Request, Response });
|
||||
|
||||
vi.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
useChrome: () => ({
|
||||
isBeta: () => false,
|
||||
isProd: () => true,
|
||||
|
|
@ -97,7 +100,7 @@ describe('Create Share To Regions Modal', () => {
|
|||
});
|
||||
|
||||
test('select options disabled correctly based on status and region', async () => {
|
||||
renderCustomRoutesWithReduxRouter(`share/${composeId}`, {}, routes);
|
||||
await renderCustomRoutesWithReduxRouter(`share/${composeId}`, {}, routes);
|
||||
|
||||
const selectToggle = await screen.findByRole('button', {
|
||||
name: /menu toggle/i,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue