diff --git a/playwright/test.spec.ts b/playwright/test.spec.ts index 0f46028e..bdd02268 100644 --- a/playwright/test.spec.ts +++ b/playwright/test.spec.ts @@ -87,7 +87,7 @@ test.describe.serial('test', () => { await frame.getByRole('button', { name: 'Create blueprint' }).click(); await expect( - frame.locator('.pf-v6-c-card__title-text').getByText(blueprintName), + frame.locator('.pf-v6-c-card__title-text').getByText(blueprintName) ).toBeVisible(); }); @@ -205,7 +205,7 @@ test.describe.serial('test', () => { if (await switchInput.isChecked()) { await frame.getByRole('button', { name: 'Cancel' }).click(); await expect( - frame.getByRole('heading', { name: 'All images' }), + frame.getByRole('heading', { name: 'All images' }) ).toBeVisible(); } else { const switchToggle = frame.locator('.pf-v6-c-switch'); @@ -219,7 +219,7 @@ test.describe.serial('test', () => { await frame.getByPlaceholder('Path to AWS credentials').fill(credentials); await frame.getByRole('button', { name: 'Submit' }).click(); await expect( - frame.getByRole('heading', { name: 'All images' }), + frame.getByRole('heading', { name: 'All images' }) ).toBeVisible(); } @@ -236,7 +236,7 @@ test.describe.serial('test', () => { await expect(frame.getByPlaceholder('AWS bucket')).toHaveValue(bucket); await expect(frame.getByPlaceholder('Path to AWS credentials')).toHaveValue( - credentials, + credentials ); await frame.getByRole('button', { name: 'Cancel' }).click(); @@ -276,7 +276,7 @@ test.describe.serial('test', () => { frame.getByRole('heading', { name: 'Details' }); await frame.getByTestId('blueprint').fill(cockpitBlueprintname); await expect(frame.getByTestId('blueprint')).toHaveValue( - cockpitBlueprintname, + cockpitBlueprintname ); await frame.getByRole('button', { name: 'Next', exact: true }).click(); diff --git a/src/Components/Blueprints/ImportBlueprintModal.tsx b/src/Components/Blueprints/ImportBlueprintModal.tsx index 88ab60fb..9dfafeca 100644 --- a/src/Components/Blueprints/ImportBlueprintModal.tsx +++ b/src/Components/Blueprints/ImportBlueprintModal.tsx @@ -155,9 +155,8 @@ export const ImportBlueprintModal: React.FunctionComponent< blueprintFromFile.content_sources && blueprintFromFile.content_sources.length > 0 ) { - const imported = await handleRepositoryImport( - blueprintFromFile - ); + const imported = + await handleRepositoryImport(blueprintFromFile); customRepos = imported ?? []; } @@ -308,10 +307,10 @@ export const ImportBlueprintModal: React.FunctionComponent< {isRejected ? 'Must be a valid Blueprint JSON/TOML file no larger than 512 KB' : isInvalidFormat - ? 'Not compatible with the blueprints format.' - : isOnPrem - ? 'Importing on-premises blueprints is currently in beta. Results may vary.' - : 'Upload your blueprint file. Supported formats: JSON, TOML.'} + ? 'Not compatible with the blueprints format.' + : isOnPrem + ? 'Importing on-premises blueprints is currently in beta. Results may vary.' + : 'Upload your blueprint file. Supported formats: JSON, TOML.'} diff --git a/src/Components/CloudProviderConfig/AWSConfig.tsx b/src/Components/CloudProviderConfig/AWSConfig.tsx index 4bd2404d..334021b7 100644 --- a/src/Components/CloudProviderConfig/AWSConfig.tsx +++ b/src/Components/CloudProviderConfig/AWSConfig.tsx @@ -38,7 +38,7 @@ type ToggleGroupProps = Omit, 'isDisabled'>; const AWSConfigToggle = ({ value, onChange }: ToggleGroupProps) => { const handleChange = ( _event: React.FormEvent, - checked: boolean, + checked: boolean ) => { onChange(checked); }; diff --git a/src/Components/CloudProviderConfig/CloudProviderConfig.tsx b/src/Components/CloudProviderConfig/CloudProviderConfig.tsx index ed5523a4..a8bfe3af 100644 --- a/src/Components/CloudProviderConfig/CloudProviderConfig.tsx +++ b/src/Components/CloudProviderConfig/CloudProviderConfig.tsx @@ -97,7 +97,7 @@ export const CloudProviderConfig = () => { dispatch(changeAWSCredsPath(credentials)); } }, - [dispatch, setEnabled], + [dispatch, setEnabled] ); useEffect(() => { diff --git a/src/Components/CreateImageWizard/CreateImageWizard.tsx b/src/Components/CreateImageWizard/CreateImageWizard.tsx index 3507693e..01f36f0b 100644 --- a/src/Components/CreateImageWizard/CreateImageWizard.tsx +++ b/src/Components/CreateImageWizard/CreateImageWizard.tsx @@ -442,10 +442,10 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => { !isAzureSubscriptionIdValid(azureSubscriptionId) || !isAzureResourceGroupValid(azureResourceGroup) : azureShareMethod === 'sources' - ? !isAzureTenantGUIDValid(azureTenantId) || - !isAzureSubscriptionIdValid(azureSubscriptionId) || - !isAzureResourceGroupValid(azureResourceGroup) - : azureSource === undefined + ? !isAzureTenantGUIDValid(azureTenantId) || + !isAzureSubscriptionIdValid(azureSubscriptionId) || + !isAzureResourceGroupValid(azureResourceGroup) + : azureSource === undefined } /> } diff --git a/src/Components/CreateImageWizard/ValidatedInput.tsx b/src/Components/CreateImageWizard/ValidatedInput.tsx index 24f5fbfb..271898a9 100644 --- a/src/Components/CreateImageWizard/ValidatedInput.tsx +++ b/src/Components/CreateImageWizard/ValidatedInput.tsx @@ -116,8 +116,8 @@ const getValidationState = ( const validated = isPristine ? 'default' : (isRequired && errorMessage) || errorMessage - ? 'error' - : 'success'; + ? 'error' + : 'success'; return validated; }; diff --git a/src/Components/CreateImageWizard/steps/ImageOutput/components/TargetEnvironment.tsx b/src/Components/CreateImageWizard/steps/ImageOutput/components/TargetEnvironment.tsx index 029f7678..2d98e3f7 100644 --- a/src/Components/CreateImageWizard/steps/ImageOutput/components/TargetEnvironment.tsx +++ b/src/Components/CreateImageWizard/steps/ImageOutput/components/TargetEnvironment.tsx @@ -142,8 +142,14 @@ const TargetEnvironment = () => { }; if (isFetching) { - return - }; + return ( + + ); + } if (isError) { return ( @@ -152,10 +158,11 @@ const TargetEnvironment = () => { variant="danger" isInline > - Target environments couldn't be loaded, please refresh the page or try again later. + Target environments couldn't be loaded, please refresh the page or + try again later. - ) - }; + ); + } return ( { const onKeyDown = (event: React.KeyboardEvent) => { if (event.key === 'Enter') { event.preventDefault(); - + if (!isOpen) { setIsOpen(true); } else if (selectOptions.length === 1) { @@ -220,7 +220,7 @@ const ProfileSelector = () => { profileID: singleProfile.id, toString: () => singleProfile.name || '', }; - + setInputValue(singleProfile.name || ''); setFilterValue(''); applyChanges(selection); diff --git a/src/Components/CreateImageWizard/steps/Packages/Packages.tsx b/src/Components/CreateImageWizard/steps/Packages/Packages.tsx index 7c278c04..58e186fe 100644 --- a/src/Components/CreateImageWizard/steps/Packages/Packages.tsx +++ b/src/Components/CreateImageWizard/steps/Packages/Packages.tsx @@ -1485,8 +1485,8 @@ const Packages = () => { packages.length + groups.length === 0 ? '' : packages.length + groups.length <= 100 - ? ` (${packages.length + groups.length})` - : ' (100+)' + ? ` (${packages.length + groups.length})` + : ' (100+)' }`} buttonId="toggle-selected" isSelected={toggleSelected === 'toggle-selected'} @@ -1501,10 +1501,10 @@ const Packages = () => { searchTerm === '' && toggleSelected === 'toggle-available' ? 0 : showPackages && showGroups - ? transformedPackages.length + transformedGroups.length - : showPackages - ? transformedPackages.length - : transformedGroups.length + ? transformedPackages.length + transformedGroups.length + : showPackages + ? transformedPackages.length + : transformedGroups.length } perPage={perPage} page={page} @@ -1550,10 +1550,10 @@ const Packages = () => { searchTerm === '' && toggleSelected === 'toggle-available' ? 0 : showPackages && showGroups - ? transformedPackages.length + transformedGroups.length - : showPackages - ? transformedPackages.length - : transformedGroups.length + ? transformedPackages.length + transformedGroups.length + : showPackages + ? transformedPackages.length + : transformedGroups.length } perPage={perPage} page={page} diff --git a/src/Components/CreateImageWizard/steps/Registration/components/SatelliteRegistration.tsx b/src/Components/CreateImageWizard/steps/Registration/components/SatelliteRegistration.tsx index 5eb8a732..be224058 100644 --- a/src/Components/CreateImageWizard/steps/Registration/components/SatelliteRegistration.tsx +++ b/src/Components/CreateImageWizard/steps/Registration/components/SatelliteRegistration.tsx @@ -26,8 +26,8 @@ const SatelliteRegistration = () => { const validated = stepValidation.errors['certificate'] ? 'error' : stepValidation.errors['certificate'] === undefined && caCertificate - ? 'success' - : 'default'; + ? 'success' + : 'default'; const handleClear = () => { dispatch(changeSatelliteCaCertificate('')); }; @@ -79,17 +79,17 @@ const SatelliteRegistration = () => { isRejected || validated === 'error' ? 'error' : validated === 'success' - ? 'success' - : 'default' + ? 'success' + : 'default' } > {isRejected ? 'Must be a .PEM/.CER/.CRT file no larger than 512 KB' : validated === 'error' - ? stepValidation.errors['certificate'] - : validated === 'success' - ? 'Certificate was uploaded' - : 'Drag and drop a valid certificate file or upload one'} + ? stepValidation.errors['certificate'] + : validated === 'success' + ? 'Certificate was uploaded' + : 'Drag and drop a valid certificate file or upload one'} {(isRejected || validated !== 'success') && ( diff --git a/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx b/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx index c44f4902..71ca07f1 100644 --- a/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx +++ b/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx @@ -140,8 +140,8 @@ export const SnapshotTable = ({ snapshotForDate.length > 0 ? snapshotForDate.map(({ repository_uuid }) => repository_uuid).join() : template && templateData && templateData.repository_uuids - ? templateData.repository_uuids.join(',') - : '', + ? templateData.repository_uuids.join(',') + : '', origin: ContentOrigin.REDHAT + ',' + ContentOrigin.CUSTOM, // Make sure to show both redhat and external }); diff --git a/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx b/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx index ce0c76ec..5a610f24 100644 --- a/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx +++ b/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx @@ -313,10 +313,10 @@ export const TargetEnvGCPList = () => { {accountType === 'group' ? 'Google group' : accountType === 'serviceAccount' - ? 'Service account' - : accountType === 'user' - ? 'Google account' - : 'Domain'} + ? 'Service account' + : accountType === 'user' + ? 'Google account' + : 'Domain'} { useLatest ? 'Use the latest repository content' : template - ? 'Use content from the content template' - : `Repositories as of ${yyyyMMddFormat( - new Date(snapshotDate) - )}` + ? 'Use content from the content template' + : `Repositories as of ${yyyyMMddFormat( + new Date(snapshotDate) + )}` } hasAutoWidth minWidth="60rem" diff --git a/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/AwsAccountId.tsx b/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/AwsAccountId.tsx index e8ce5597..7487ba81 100644 --- a/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/AwsAccountId.tsx +++ b/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/AwsAccountId.tsx @@ -37,7 +37,7 @@ export const AwsAccountId = () => { readOnlyVariant="default" isRequired id="aws-account-id" - value={sourceId && data ? data.aws?.account_id ?? '' : ''} + value={sourceId && data ? (data.aws?.account_id ?? '') : ''} aria-label="aws account id" /> diff --git a/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/index.tsx b/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/index.tsx index bcbaffc9..3c936d18 100644 --- a/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/index.tsx +++ b/src/Components/CreateImageWizard/steps/TargetEnvironment/Aws/index.tsx @@ -64,7 +64,7 @@ const AWSRegion = ({ value, onChange }: FormGroupProps) => { const onSelect = ( _event: React.MouseEvent | undefined, - value: string | number | undefined, + value: string | number | undefined ) => { onChange(value as string); setIsOpen(false); diff --git a/src/Components/CreateImageWizard/utilities/PasswordValidatedInput.tsx b/src/Components/CreateImageWizard/utilities/PasswordValidatedInput.tsx index 972902d7..716ab254 100644 --- a/src/Components/CreateImageWizard/utilities/PasswordValidatedInput.tsx +++ b/src/Components/CreateImageWizard/utilities/PasswordValidatedInput.tsx @@ -51,14 +51,14 @@ export const PasswordValidatedInput = ({ const PasswordToggleButton = () => { return ( - + ); }; @@ -78,13 +78,13 @@ export const PasswordValidatedInput = ({ {isEditingWithoutValue ? ( - + - + - + ) : ( - + )} diff --git a/src/Components/CreateImageWizard/utilities/requestMapper.ts b/src/Components/CreateImageWizard/utilities/requestMapper.ts index ec165c69..e41c859b 100644 --- a/src/Components/CreateImageWizard/utilities/requestMapper.ts +++ b/src/Components/CreateImageWizard/utilities/requestMapper.ts @@ -165,12 +165,12 @@ const getLatestRelease = (distribution: Distributions) => { return distribution.startsWith('rhel-10') ? RHEL_10 : distribution.startsWith('rhel-9') - ? RHEL_9 - : distribution.startsWith('rhel-8') - ? RHEL_8 - : distribution === ('centos-8' as Distributions) - ? CENTOS_9 - : distribution; + ? RHEL_9 + : distribution.startsWith('rhel-8') + ? RHEL_8 + : distribution === ('centos-8' as Distributions) + ? CENTOS_9 + : distribution; }; function commonRequestToState( @@ -256,13 +256,13 @@ function commonRequestToState( policyTitle: undefined, } : oscapProfile !== undefined - ? { - complianceType: 'openscap' as ComplianceType, - profileID: oscapProfile, - policyID: undefined, - policyTitle: undefined, - } - : initialState.compliance, + ? { + complianceType: 'openscap' as ComplianceType, + profileID: oscapProfile, + policyID: undefined, + policyTitle: undefined, + } + : initialState.compliance, firstBoot: request.customizations ? { script: getFirstBootScript(request.customizations.files), @@ -393,8 +393,8 @@ export const mapRequestToState = (request: BlueprintResponse): wizardState => { ? 'register-now-rhc' : 'register-now-insights' : getSatelliteCommand(request.customizations.files) - ? 'register-satellite' - : 'register-later', + ? 'register-satellite' + : 'register-later', activationKey: isRhel(request.distribution) ? request.customizations.subscription?.['activation-key'] : undefined, diff --git a/src/Components/ImagesTable/Instance.tsx b/src/Components/ImagesTable/Instance.tsx index dda9892c..5c10cf07 100644 --- a/src/Components/ImagesTable/Instance.tsx +++ b/src/Components/ImagesTable/Instance.tsx @@ -117,7 +117,7 @@ const ProvisioningLink = ({ scope: 'provisioning', module: './ProvisioningWizard', }, - {}, + {} ); const { permissions, isLoading: isLoadingPermission } = @@ -126,7 +126,7 @@ const ProvisioningLink = ({ // Recomputing this value on every render made the modal crash. Using a state // helps avoiding this situation as the value is only set the first time. const [appendTo] = useState( - document.querySelector(MODAL_ANCHOR) as HTMLElement, + document.querySelector(MODAL_ANCHOR) as HTMLElement ); const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId); @@ -137,10 +137,10 @@ const ProvisioningLink = ({ { selectFromResult: ({ data }) => ({ selectedBlueprintVersion: data?.data.find( - (blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId, + (blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId )?.version, }), - }, + } ); if ( @@ -270,7 +270,7 @@ export const OciInstance = ({ compose, isExpired }: OciInstancePropTypes) => { if (options && !isOciUploadStatus(options)) { throw TypeError( - `Error: options must be of type OciUploadStatus, not ${typeof options}.`, + `Error: options must be of type OciUploadStatus, not ${typeof options}.` ); } @@ -404,7 +404,7 @@ export const AwsS3Instance = ({ if (options && !isAwss3UploadStatus(options)) { throw TypeError( - `Error: options must be of type Awss3UploadStatus, not ${typeof options}.`, + `Error: options must be of type Awss3UploadStatus, not ${typeof options}.` ); } diff --git a/src/Components/ImagesTable/Target.tsx b/src/Components/ImagesTable/Target.tsx index 33a7dea5..1181b824 100644 --- a/src/Components/ImagesTable/Target.tsx +++ b/src/Components/ImagesTable/Target.tsx @@ -3,7 +3,10 @@ import React from 'react'; import { Skeleton } from '@patternfly/react-core'; import { targetOptions } from '../../constants'; -import { ComposesResponseItem, useGetComposeClonesQuery } from '../../store/imageBuilderApi'; +import { + ComposesResponseItem, + useGetComposeClonesQuery, +} from '../../store/imageBuilderApi'; type TargetPropTypes = { compose: ComposesResponseItem; diff --git a/src/Hooks/MutationNotifications/useMutationWithNotification.tsx b/src/Hooks/MutationNotifications/useMutationWithNotification.tsx index 8499c28a..5a32444b 100644 --- a/src/Hooks/MutationNotifications/useMutationWithNotification.tsx +++ b/src/Hooks/MutationNotifications/useMutationWithNotification.tsx @@ -50,7 +50,7 @@ export function useMutationWithNotification< isError: boolean; error?: unknown; reset: () => void; - } + }, >( mutationHook: ( options?: HookOptions diff --git a/src/store/listenerMiddleware.ts b/src/store/listenerMiddleware.ts index a1fd379b..6e5744d2 100644 --- a/src/store/listenerMiddleware.ts +++ b/src/store/listenerMiddleware.ts @@ -4,7 +4,7 @@ import { addListener, createListenerMiddleware, type TypedAddListener, - type TypedStartListening + type TypedStartListening, } from '@reduxjs/toolkit'; import type { AppDispatch, RootState } from './index'; diff --git a/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx b/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx index 88200855..5bad2736 100644 --- a/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx +++ b/src/test/Components/Blueprints/ImportBlueprintModal.test.tsx @@ -469,9 +469,8 @@ describe('Import modal', () => { // Timezone await clickNext(); await screen.findByRole('heading', { name: /Timezone/ }); - const timezoneDropDown = await screen.findByPlaceholderText( - /Select a timezone/i - ); + const timezoneDropDown = + await screen.findByPlaceholderText(/Select a timezone/i); expect(timezoneDropDown).toHaveValue('US/Eastern'); await screen.findByText(/0\.north-america\.pool\.ntp\.org/i); await screen.findByText(/1\.north-america\.pool\.ntp\.org/i); @@ -481,9 +480,8 @@ describe('Import modal', () => { await screen.findByRole('heading', { name: /Locale/ }); await screen.findByText('English - United States (en_US.UTF-8)'); await screen.findByText('Japanese - Japan (ja_JP.UTF-8)'); - const keyboardDropDown = await screen.findByPlaceholderText( - /Select a keyboard/i - ); + const keyboardDropDown = + await screen.findByPlaceholderText(/Select a keyboard/i); expect(keyboardDropDown).toHaveValue('us'); // Hostname @@ -640,7 +638,9 @@ describe('Import modal', () => { ); await waitFor(() => user.click( - screen.getByRole('button', { name: /close invalid\$kernel\$argument/i }) + screen.getByRole('button', { + name: /close invalid\$kernel\$argument/i, + }) ) ); diff --git a/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx b/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx index 7de2f02f..48dbb379 100644 --- a/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Details/Details.test.tsx @@ -55,9 +55,8 @@ const goToReviewStep = async () => { const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('image-details-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-details' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-details'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/Firewall/Firewall.test.tsx b/src/test/Components/CreateImageWizard/steps/Firewall/Firewall.test.tsx index 72eab036..1013dbdd 100644 --- a/src/test/Components/CreateImageWizard/steps/Firewall/Firewall.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Firewall/Firewall.test.tsx @@ -58,26 +58,23 @@ const addPort = async (port: string) => { const addEnabledFirewallService = async (service: string) => { const user = userEvent.setup(); - const enabledServicesInput = await screen.findByPlaceholderText( - /add enabled service/i - ); + const enabledServicesInput = + await screen.findByPlaceholderText(/add enabled service/i); await waitFor(() => user.type(enabledServicesInput, service.concat(' '))); }; const addDisabledFirewallService = async (service: string) => { const user = userEvent.setup(); - const disabledServiceInput = await screen.findByPlaceholderText( - /add disabled service/i - ); + const disabledServiceInput = + await screen.findByPlaceholderText(/add disabled service/i); await waitFor(() => user.type(disabledServiceInput, service.concat(' '))); }; const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('firewall-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-firewall' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-firewall'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/FirstBoot/Firstboot.test.tsx b/src/test/Components/CreateImageWizard/steps/FirstBoot/Firstboot.test.tsx index c0999e20..4c04f797 100644 --- a/src/test/Components/CreateImageWizard/steps/FirstBoot/Firstboot.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/FirstBoot/Firstboot.test.tsx @@ -109,9 +109,8 @@ const goToReviewStep = async (): Promise => { const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('firstboot-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-first-boot' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-first-boot'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/Hostname/Hostname.test.tsx b/src/test/Components/CreateImageWizard/steps/Hostname/Hostname.test.tsx index 1c12717e..85f2ac5f 100644 --- a/src/test/Components/CreateImageWizard/steps/Hostname/Hostname.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Hostname/Hostname.test.tsx @@ -73,9 +73,8 @@ const clearHostname = async () => { const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('hostname-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-hostname' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-hostname'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/Locale/Locale.test.tsx b/src/test/Components/CreateImageWizard/steps/Locale/Locale.test.tsx index 97b63798..41a312c3 100644 --- a/src/test/Components/CreateImageWizard/steps/Locale/Locale.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Locale/Locale.test.tsx @@ -52,17 +52,15 @@ const goToReviewStep = async () => { const clearLanguageSearch = async () => { const user = userEvent.setup(); - const languagesDropdown = await screen.findByPlaceholderText( - /select a language/i - ); + const languagesDropdown = + await screen.findByPlaceholderText(/select a language/i); await waitFor(() => user.clear(languagesDropdown)); }; const searchForLanguage = async (search: string) => { const user = userEvent.setup(); - const languagesDropdown = await screen.findByPlaceholderText( - /select a language/i - ); + const languagesDropdown = + await screen.findByPlaceholderText(/select a language/i); await waitFor(() => user.type(languagesDropdown, search)); }; @@ -83,9 +81,8 @@ const selectLanguages = async () => { const searchForKeyboard = async (keyboard: string) => { const user = userEvent.setup({ delay: null }); - const keyboardDropdown = await screen.findByPlaceholderText( - /select a keyboard/i - ); + const keyboardDropdown = + await screen.findByPlaceholderText(/select a keyboard/i); await waitFor(() => user.type(keyboardDropdown, keyboard)); }; diff --git a/src/test/Components/CreateImageWizard/steps/Oscap/Compliance.test.tsx b/src/test/Components/CreateImageWizard/steps/Oscap/Compliance.test.tsx index b0269b75..73341a1d 100644 --- a/src/test/Components/CreateImageWizard/steps/Oscap/Compliance.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Oscap/Compliance.test.tsx @@ -85,9 +85,8 @@ const selectPolicy = async () => { const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('compliance-detail-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-compliance' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-compliance'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx b/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx index 8def9399..ad8273c2 100644 --- a/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Oscap/Oscap.test.tsx @@ -103,9 +103,8 @@ const goToReviewStep = async () => { const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('oscap-detail-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-openscap' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-openscap'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx b/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx index d4c2bb7c..cb55d4e7 100644 --- a/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Registration/Registration.test.tsx @@ -98,9 +98,8 @@ const selectActivationKey = async (key: string) => { const addSatelliteRegistrationCommandViaKeyDown = async (command: string) => { const user = userEvent.setup({ delay: null }); - const satelliteRegistrationCommand = await screen.findByPlaceholderText( - /registration command/i - ); + const satelliteRegistrationCommand = + await screen.findByPlaceholderText(/registration command/i); await waitFor(() => user.clear(satelliteRegistrationCommand)); await waitFor(() => user.type(satelliteRegistrationCommand, command)); @@ -108,7 +107,7 @@ const addSatelliteRegistrationCommandViaKeyDown = async (command: string) => { }; const uploadFile = async (scriptName: string): Promise => { - const user = userEvent.setup({ delay: null}); + const user = userEvent.setup({ delay: null }); const fileInput: HTMLElement | null = // eslint-disable-next-line testing-library/no-node-access document.querySelector('input[type="file"]'); diff --git a/src/test/Components/CreateImageWizard/steps/Services/Services.test.tsx b/src/test/Components/CreateImageWizard/steps/Services/Services.test.tsx index 0255fdc5..004db028 100644 --- a/src/test/Components/CreateImageWizard/steps/Services/Services.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Services/Services.test.tsx @@ -90,9 +90,8 @@ const addDisabledService = async (service: string) => { const addMaskedService = async (service: string) => { const user = userEvent.setup(); - const maskedServiceInput = await screen.findByPlaceholderText( - 'Add masked service' - ); + const maskedServiceInput = + await screen.findByPlaceholderText('Add masked service'); await waitFor(() => user.type(maskedServiceInput, service.concat(' '))); }; @@ -126,9 +125,8 @@ const selectProfile = async () => { const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('services-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-services' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-services'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx index 5fa248b8..bc57ea5c 100644 --- a/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/TargetEnvironment/AzureTarget.test.tsx @@ -3,7 +3,11 @@ import { screen, waitFor, within } from '@testing-library/react'; import { userEvent } from '@testing-library/user-event'; import { http, HttpResponse } from 'msw'; -import { CREATE_BLUEPRINT, EDIT_BLUEPRINT, PROVISIONING_API } from '../../../../../constants'; +import { + CREATE_BLUEPRINT, + EDIT_BLUEPRINT, + PROVISIONING_API, +} from '../../../../../constants'; import { CreateBlueprintRequest, ImageRequest, diff --git a/src/test/Components/CreateImageWizard/steps/Timezone/Timezone.test.tsx b/src/test/Components/CreateImageWizard/steps/Timezone/Timezone.test.tsx index 5adf8503..6209ffa9 100644 --- a/src/test/Components/CreateImageWizard/steps/Timezone/Timezone.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Timezone/Timezone.test.tsx @@ -52,9 +52,8 @@ const goToReviewStep = async () => { const selectTimezone = async () => { const user = userEvent.setup({ delay: null }); - const timezoneDropdown = await screen.findByPlaceholderText( - /select a timezone/i - ); + const timezoneDropdown = + await screen.findByPlaceholderText(/select a timezone/i); await waitFor(() => user.type(timezoneDropdown, 'Europe/Am')); const amsterdamTimezone = await screen.findByText('Europe/Amsterdam'); await waitFor(() => user.click(amsterdamTimezone)); @@ -62,25 +61,22 @@ const selectTimezone = async () => { const searchForUnknownTimezone = async () => { const user = userEvent.setup(); - const timezoneDropdown = await screen.findByPlaceholderText( - /select a timezone/i - ); + const timezoneDropdown = + await screen.findByPlaceholderText(/select a timezone/i); await waitFor(() => user.type(timezoneDropdown, 'foo')); }; const addNtpServerViaKeyDown = async (ntpServer: string) => { const user = userEvent.setup(); - const ntpServersInput = await screen.findByPlaceholderText( - /add ntp servers/i - ); + const ntpServersInput = + await screen.findByPlaceholderText(/add ntp servers/i); await waitFor(() => user.type(ntpServersInput, ntpServer.concat(' '))); }; const addNtpServerViaAddButton = async (ntpServer: string) => { const user = userEvent.setup(); - const ntpServersInput = await screen.findByPlaceholderText( - /add ntp servers/i - ); + const ntpServersInput = + await screen.findByPlaceholderText(/add ntp servers/i); const addServerBtn = await screen.findByRole('button', { name: /add ntp server/i, }); @@ -99,9 +95,8 @@ const clearInput = async () => { const clickRevisitButton = async () => { const user = userEvent.setup(); const expandable = await screen.findByTestId('timezone-expandable'); - const revisitButton = await within(expandable).findByTestId( - 'revisit-timezone' - ); + const revisitButton = + await within(expandable).findByTestId('revisit-timezone'); await waitFor(() => user.click(revisitButton)); }; diff --git a/src/test/Components/CreateImageWizard/steps/Users/Users.test.tsx b/src/test/Components/CreateImageWizard/steps/Users/Users.test.tsx index e0704deb..9b84dd2b 100644 --- a/src/test/Components/CreateImageWizard/steps/Users/Users.test.tsx +++ b/src/test/Components/CreateImageWizard/steps/Users/Users.test.tsx @@ -61,9 +61,8 @@ const addAzureTarget = async () => { ); await clickNext(); - const azureSourceDropdown = await screen.findByPlaceholderText( - /select source/i - ); + const azureSourceDropdown = + await screen.findByPlaceholderText(/select source/i); await waitFor(() => user.click(azureSourceDropdown)); const azureSource = await screen.findByRole('option', { name: /azureSource1/i, @@ -182,9 +181,8 @@ const checkAdminCheckbox = async () => { const addUserGroupByUserIndex = async (group: string, index: number) => { const user = userEvent.setup(); - const userGroupInputs = await screen.findAllByPlaceholderText( - 'Add user group' - ); + const userGroupInputs = + await screen.findAllByPlaceholderText('Add user group'); await waitFor(() => user.click(userGroupInputs[index])); await waitFor(() => user.type(userGroupInputs[index], group)); const addGroup = await screen.findByRole('button', { @@ -512,24 +510,32 @@ describe('Users edit mode', () => { const id = mockBlueprintIds['users']; await renderEditMode(id); - const usersNavButtons = await screen.findAllByRole('button', { name: /Users/ }); + const usersNavButtons = await screen.findAllByRole('button', { + name: /Users/, + }); await waitFor(() => user.click(usersNavButtons[0])); const passwordToggleButton = await screen.findByRole('button', { - name: 'Show password' + name: 'Show password', }); expect(passwordToggleButton).toBeDisabled(); await waitFor(() => user.hover(passwordToggleButton)); - const tooltip = await screen.findByText('Passwords cannot be viewed when editing a blueprint for security reasons'); + const tooltip = await screen.findByText( + 'Passwords cannot be viewed when editing a blueprint for security reasons' + ); expect(tooltip).toBeInTheDocument(); await waitFor(() => user.unhover(passwordToggleButton)); await waitFor(() => { - expect(screen.queryByText('Passwords cannot be viewed when editing a blueprint for security reasons')).not.toBeInTheDocument(); + expect( + screen.queryByText( + 'Passwords cannot be viewed when editing a blueprint for security reasons' + ) + ).not.toBeInTheDocument(); }); }); }); diff --git a/src/test/Components/ImagesTable/ImagesTable.test.tsx b/src/test/Components/ImagesTable/ImagesTable.test.tsx index 532420c5..23db3cd6 100644 --- a/src/test/Components/ImagesTable/ImagesTable.test.tsx +++ b/src/test/Components/ImagesTable/ImagesTable.test.tsx @@ -83,9 +83,8 @@ describe('Images Table', () => { // No actual clicking because downloading is hard to test. // Instead, we just check href and download properties of the element. - const downloadLink: HTMLAnchorElement = await within( - downloadButton - ).findByRole('link'); + const downloadLink: HTMLAnchorElement = + await within(downloadButton).findByRole('link'); expect(downloadLink.download).toBe( 'request-1579d95b-8f1d-4982-8c53-8c2afa4ab04c.json' ); diff --git a/src/test/setup.ts b/src/test/setup.ts index a21cefa0..067ab8d1 100644 --- a/src/test/setup.ts +++ b/src/test/setup.ts @@ -8,10 +8,12 @@ import 'vitest-canvas-mock'; window.HTMLElement.prototype.scrollTo = function () {}; // provide a fallback *only* when window.getComputedStyle is missing -// eslint-disable-next-line disable-autofix/@typescript-eslint/no-unnecessary-condition -window.getComputedStyle = window.getComputedStyle || (() => ({ - getPropertyValue: () => '', -})); +window.getComputedStyle = + // eslint-disable-next-line disable-autofix/@typescript-eslint/no-unnecessary-condition + window.getComputedStyle || + (() => ({ + getPropertyValue: () => '', + })); // ResizeObserver is not defined and needs to be mocked and stubbed const MockResizeObserver = vi.fn(() => ({