Skip to content

Commit 49950dd

Browse files
chore(okms): apply vitestEslintConfig rules
ref: #MANAGER-19870 Signed-off-by: Mathieu Mousnier <[email protected]>
1 parent be122fe commit 49950dd

File tree

13 files changed

+39
-32
lines changed

13 files changed

+39
-32
lines changed

packages/manager/apps/okms/eslint.config.mjs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ export default eslintSharedConfig;
66
77
88
## Progressive adoption ##
9-
import { typescriptEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/typescript';
10-
import { javascriptEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/javascript';
11-
import { reactEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/react';
12-
import { prettierEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/prettier';
139
1410
import {
1511
complexityJsxTsxConfig,
@@ -19,14 +15,14 @@ import { cssEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/css'
1915
import { htmlEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/html';
2016
import { importEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/imports';
2117
import { checkFileEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/naming-conventions';
22-
import { vitestEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/tests';
2318
*/
2419
import { a11yEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/a11y';
2520
import { javascriptEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/javascript';
2621
import { prettierEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/prettier';
2722
import { reactEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/react';
2823
import { tailwindJsxConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/tailwind-jsx';
2924
import { tanStackQueryEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/tanstack';
25+
import { vitestEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/tests';
3026
import { typescriptEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/typescript';
3127

3228
export default [
@@ -64,4 +60,19 @@ export default [
6460
'tailwindcss/no-unnecessary-arbitrary-value': 'off',
6561
},
6662
},
63+
/* ------------------------------------------------------------------------ */
64+
/* Vitest Rules */
65+
/* ------------------------------------------------------------------------ */
66+
{
67+
...vitestEslintConfig,
68+
rules: {
69+
...(vitestEslintConfig.rules ?? {}),
70+
'vitest/expect-expect': [
71+
'error',
72+
{
73+
assertFunctionNames: ['expect*', 'assert*'],
74+
},
75+
],
76+
},
77+
},
6778
];

packages/manager/apps/okms/src/common/components/okms-dashboard/billing-tile/BillingTile.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('OKMS Billing Tile test suite', () => {
7171
];
7272

7373
it.each(useCases)(
74-
'should display tile content and have productType $productType resiliate link $resiliateLink ',
74+
'should display tile content and have productType $productType resiliate link $resiliateLink',
7575
async ({ productType, resiliateLink }) => {
7676
vi.mocked(useProductType).mockReturnValue(productType);
7777
const user = userEvent.setup();

packages/manager/apps/okms/src/modules/key-management-service/hooks/breadcrumb/useBreadcrumb.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('useBreadcumb test suite', () => {
8484
expect(result.current[1].navigateTo).toEqual(items[1].navigateTo);
8585
});
8686

87-
it('should not have a navigateTo url when no corresponding given item is found ', () => {
87+
it('should not have a navigateTo url when no corresponding given item is found', () => {
8888
// given
8989
const { result } = renderHook(() => useBreadcrumb({ items }));
9090

packages/manager/apps/okms/src/modules/key-management-service/hooks/service-key/useServiceKeyOperationsTranslations.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vi.mock('react-i18next', () => ({
1212
}),
1313
}));
1414

15-
describe('get service key operations translation ', () => {
15+
describe('get service key operations translation', () => {
1616
const useCases: {
1717
operation: OkmsServiceKeyOperations;
1818
translationKey: string;

packages/manager/apps/okms/src/modules/key-management-service/hooks/service-key/useServiceKeyTypeTranslations.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vi.mock('react-i18next', () => ({
1212
}),
1313
}));
1414

15-
describe('get service key type translation ', () => {
15+
describe('get service key type translation', () => {
1616
const useCases: {
1717
type: OkmsKeyTypes;
1818
translationKey: string;

packages/manager/apps/okms/src/modules/key-management-service/pages/create/CreateKms.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const pickRegion = async (user: UserEvent) => {
4040
await act(() => user.click(firstRegionOption));
4141
};
4242

43-
const waitOrderButtonToBeEnabled = async () => {
43+
const expectOrderButtonToBeEnabled = async () => {
4444
await waitFor(() => {
4545
expect(screen.getByTestId(CREATE_KMS_TEST_IDS.CTA_ORDER)).toBeEnabled();
4646
});
@@ -90,7 +90,7 @@ describe('KMS creation page test suite', () => {
9090

9191
await pickRegion(user);
9292

93-
await waitOrderButtonToBeEnabled();
93+
await expectOrderButtonToBeEnabled();
9494
});
9595

9696
it('should open the order modal on order button click', async () => {
@@ -99,7 +99,7 @@ describe('KMS creation page test suite', () => {
9999

100100
await pickRegion(user);
101101

102-
await waitOrderButtonToBeEnabled();
102+
await expectOrderButtonToBeEnabled();
103103

104104
// Click on order button
105105
await act(async () => {

packages/manager/apps/okms/src/modules/secret-manager/hooks/useBackToOkmsListUrl.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('useBackToOkmsListUrl tests suite', () => {
7878
expect(result.current).toBeNull();
7979
});
8080

81-
it('should return the okms List url when there is more than one kms on a region ', async () => {
81+
it('should return the okms List url when there is more than one kms on a region', async () => {
8282
// GIVEN
8383
const mockedUrl = SECRET_MANAGER_ROUTES_URLS.okmsList(REGION_EU_WEST_RBX);
8484
mockGetOkmsList.mockResolvedValue([okmsRoubaix1Mock, okmsRoubaix2Mock]);

packages/manager/apps/okms/src/modules/secret-manager/hooks/useRegionSelector.spec.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,6 @@ describe('useRegionSelector tests suite', () => {
154154
expect(result.current.currentRegion).toEqual(sbgRegionOptionMock);
155155
});
156156

157-
it('should set current region based on useCurrentRegion result', async () => {
158-
mockUseCurrentRegion.mockReturnValue(REGION_EU_WEST_SBG);
159-
160-
const { result } = await renderCustomHook('success');
161-
162-
expect(result.current.currentRegion).toEqual(sbgRegionOptionMock);
163-
});
164-
165157
it('should return first region as current when no current region is provided', async () => {
166158
mockUseCurrentRegion.mockReturnValue(undefined);
167159

packages/manager/apps/okms/src/modules/secret-manager/pages/create-secret/SecretForm.component.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe('Secrets creation form test suite', () => {
9999
shouldButtonBeDisabled: false,
100100
},
101101
])(
102-
'should check the form validity for data: $data, path: $path and a selectedOkms: $selectedOkmsId ',
102+
'should check the form validity for data: $data, path: $path and a selectedOkms: $selectedOkmsId',
103103
async ({ data, path, selectedOkmsId, shouldButtonBeDisabled }) => {
104104
// GIVEN
105105
const user = userEvent.setup();

packages/manager/apps/okms/src/modules/secret-manager/pages/drawers/create-version-drawer/CreateVersionDrawer.page.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ describe('Secret create version drawer page test suite', () => {
6666
const { container } = await renderPage();
6767

6868
// Check disabled sumbit button
69-
await getOdsButtonByLabel({
69+
const button = await getOdsButtonByLabel({
7070
container,
7171
label: labels.common.actions.add,
7272
disabled: true,
7373
});
74+
expect(button).toBeInTheDocument();
7475
});
7576

7677
it('should display the current secret value', async () => {

0 commit comments

Comments
 (0)