fix linting warnings
this commit fix some linting warnings that user get when running npm run lint:js:fix command, some worning comes after big changes to TypeScript
This commit is contained in:
parent
536312680d
commit
303e557f07
8 changed files with 13 additions and 94 deletions
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import CreateImageWizard from '../../../Components/CreateImageWizard/CreateImageWizard';
|
||||
|
|
@ -28,8 +28,6 @@ const routes = [
|
|||
},
|
||||
];
|
||||
|
||||
let router = undefined;
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
useChrome: () => ({
|
||||
auth: {
|
||||
|
|
@ -68,7 +66,7 @@ afterEach(() => {
|
|||
describe('Step Compliance', () => {
|
||||
test('create an image with an oscap profile', async () => {
|
||||
const user = userEvent.setup();
|
||||
({ router } = renderCustomRoutesWithReduxRouter('imagewizard', {}, routes));
|
||||
renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
|
||||
|
||||
// select aws as upload destination
|
||||
await user.click(await screen.findByTestId('upload-aws'));
|
||||
|
|
@ -121,9 +119,7 @@ describe('Step Compliance', () => {
|
|||
|
||||
describe('On Recreate', () => {
|
||||
const setup = async () => {
|
||||
({ router } = renderWithReduxRouter(
|
||||
'imagewizard/1679d95b-8f1d-4982-8c53-8c2afa4ab04c'
|
||||
));
|
||||
renderWithReduxRouter('imagewizard/1679d95b-8f1d-4982-8c53-8c2afa4ab04c');
|
||||
};
|
||||
test('with oscap profile', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ const routes = [
|
|||
},
|
||||
];
|
||||
|
||||
let store = undefined;
|
||||
let router = undefined;
|
||||
|
||||
// Mocking getComposes is necessary because in many tests we call navigate()
|
||||
|
|
@ -269,7 +268,7 @@ describe('Step Image output', () => {
|
|||
describe('Step Upload to AWS', () => {
|
||||
const user = userEvent.setup();
|
||||
const setUp = async () => {
|
||||
({ router, store } = await renderCustomRoutesWithReduxRouter(
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
|
|
@ -1027,7 +1026,7 @@ describe('Step Review', () => {
|
|||
describe('Click through all steps', () => {
|
||||
const user = userEvent.setup();
|
||||
const setUp = async () => {
|
||||
({ router, store } = await renderCustomRoutesWithReduxRouter(
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
|
|
@ -1380,7 +1379,7 @@ describe('Click through all steps', () => {
|
|||
await waitFor(() =>
|
||||
expect(router.state.location.pathname).toBe('/insights/image-builder')
|
||||
);
|
||||
// expect(store.getState().composes.allIds).toEqual(ids);
|
||||
|
||||
// set test timeout of 20 seconds
|
||||
}, 20000);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import '@testing-library/jest-dom';
|
|||
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { rest } from 'msw';
|
||||
|
||||
import CreateImageWizard from '../../../../Components/CreateImageWizard/CreateImageWizard';
|
||||
import { AARCH64, RHEL_8, RHEL_9, X86_64 } from '../../../../constants';
|
||||
|
|
@ -36,8 +35,6 @@ jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
|||
}),
|
||||
}));
|
||||
|
||||
let router = undefined;
|
||||
|
||||
beforeAll(() => {
|
||||
// scrollTo is not defined in jsdom
|
||||
window.HTMLElement.prototype.scrollTo = function () {};
|
||||
|
|
@ -45,18 +42,13 @@ beforeAll(() => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
router = undefined;
|
||||
server.resetHandlers();
|
||||
});
|
||||
|
||||
describe('Check that the target filtering is in accordance to mock content', () => {
|
||||
test('rhel9 x86_64', async () => {
|
||||
const user = userEvent.setup();
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
));
|
||||
await renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
|
||||
|
||||
// select x86_64
|
||||
const archMenu = screen.getAllByRole('button', {
|
||||
|
|
@ -95,11 +87,7 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
|||
|
||||
test('rhel8 x86_64', async () => {
|
||||
const user = userEvent.setup();
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
));
|
||||
await renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
|
||||
|
||||
// select rhel8
|
||||
const releaseMenu = screen.getAllByRole('button', {
|
||||
|
|
@ -147,11 +135,7 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
|||
|
||||
test('rhel9 aarch64', async () => {
|
||||
const user = userEvent.setup();
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
));
|
||||
await renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
|
||||
|
||||
// select aarch64
|
||||
const archMenu = screen.getAllByRole('button', {
|
||||
|
|
@ -192,11 +176,7 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
|||
|
||||
test('rhel8 aarch64', async () => {
|
||||
const user = userEvent.setup();
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
));
|
||||
await renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
|
||||
|
||||
// select rhel8
|
||||
const releaseMenu = screen.getAllByRole('button', {
|
||||
|
|
@ -250,11 +230,7 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
|||
describe('Check step consistency', () => {
|
||||
test('going back and forth with selected options only keeps the one compatible', async () => {
|
||||
const user = userEvent.setup();
|
||||
({ router } = await renderCustomRoutesWithReduxRouter(
|
||||
'imagewizard',
|
||||
{},
|
||||
routes
|
||||
));
|
||||
await renderCustomRoutesWithReduxRouter('imagewizard', {}, routes);
|
||||
|
||||
// select x86_64
|
||||
const archMenu = screen.getAllByRole('button', {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import React from 'react';
|
||||
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
import '@testing-library/jest-dom';
|
||||
import {
|
||||
|
|
@ -58,45 +55,6 @@ describe('Images Table', () => {
|
|||
compose.image_name ? compose.image_name : compose.id
|
||||
);
|
||||
|
||||
const statusValues = [
|
||||
'Ready',
|
||||
'Image build failed',
|
||||
'Image build is pending',
|
||||
'Image build in progress',
|
||||
'Image upload in progress',
|
||||
'Cloud registration in progress',
|
||||
'Image build failed',
|
||||
'Ready',
|
||||
'Image build in progress',
|
||||
'Expired',
|
||||
];
|
||||
|
||||
const targetValues = [
|
||||
'Amazon Web Services (5)',
|
||||
'Google Cloud PlatformFAKE',
|
||||
'Amazon Web Services (1)',
|
||||
'Amazon Web Services (1)',
|
||||
'Amazon Web Services (1)',
|
||||
'Amazon Web Services (1)',
|
||||
'Amazon Web Services (1)',
|
||||
'Google Cloud Platform',
|
||||
'Microsoft Azure',
|
||||
'VMWare vSphere',
|
||||
];
|
||||
|
||||
const instanceValues = [
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Launch',
|
||||
'Recreate image',
|
||||
];
|
||||
|
||||
// 10 rows for 10 images
|
||||
expect(rows).toHaveLength(10);
|
||||
rows.forEach(async (row, index) => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import React from 'react';
|
||||
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
import { useFlag } from '@unleash/proxy-client-react';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import React from 'react';
|
||||
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
import { useFlag } from '@unleash/proxy-client-react';
|
||||
|
|
|
|||
9
src/test/fixtures/oscap.ts
vendored
9
src/test/fixtures/oscap.ts
vendored
|
|
@ -3,16 +3,11 @@ import {
|
|||
GetOscapCustomizationsApiResponse,
|
||||
} from '../../store/imageBuilderApi';
|
||||
|
||||
export const distributionOscapProfiles = (
|
||||
_distribution: string
|
||||
): GetOscapProfilesApiResponse => {
|
||||
export const distributionOscapProfiles = (): GetOscapProfilesApiResponse => {
|
||||
return ['xccdf_org.ssgproject.content_profile_cis_workstation_l1'];
|
||||
};
|
||||
|
||||
export const oscapCustomizations = (
|
||||
_distribution: string,
|
||||
_profile: string
|
||||
): GetOscapCustomizationsApiResponse => {
|
||||
export const oscapCustomizations = (): GetOscapCustomizationsApiResponse => {
|
||||
return {
|
||||
filesystem: [{ min_size: 1073741824, mountpoint: '/tmp' }],
|
||||
packages: [
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import {
|
|||
composesEndpoint,
|
||||
mockClones,
|
||||
mockCloneStatus,
|
||||
mockComposes,
|
||||
mockStatus,
|
||||
} from '../fixtures/composes';
|
||||
import {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue