Skip to content

Commit

Permalink
Fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhao583 committed Jan 16, 2025
1 parent b948141 commit 40cc26d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
36 changes: 17 additions & 19 deletions frontend/src/utilities/__tests__/useEnableApplication.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { testHook } from '~/__tests__/unit/testUtils/hooks';
import { useEnableApplication, EnableApplicationStatus } from '../useEnableApplication';
import { postValidateIsv } from '~/services/validateIsvService';
import { enableIntegrationApp, getIntegrationAppEnablementStatus } from '~/services/integrationAppService';
import {
enableIntegrationApp,
getIntegrationAppEnablementStatus,
} from '~/services/integrationAppService';
import * as reduxHooks from '~/redux/hooks';
import { VariablesValidationStatus } from '~/types';
import { useEnableApplication, EnableApplicationStatus } from '~/utilities/useEnableApplication';

jest.mock('~/services/validateIsvService', () => ({
postValidateIsv: jest.fn(),
Expand All @@ -28,11 +31,11 @@ describe('useEnableApplication', () => {

it('should start in IDLE state', () => {
const renderResult = testHook(useEnableApplication)(
false,
'test-app',
'Test App',
{},
undefined
false,
'test-app',
'Test App',
{},
undefined,
);

expect(renderResult.result.current[0]).toBe(EnableApplicationStatus.IDLE);
Expand All @@ -50,7 +53,7 @@ describe('useEnableApplication', () => {
'test-app',
'Test App',
{ key: 'value' },
undefined
undefined,
);

expect(renderResult.result.current[0]).toBe(EnableApplicationStatus.IDLE);
Expand Down Expand Up @@ -82,21 +85,16 @@ describe('useEnableApplication', () => {
'test-app',
'Test App',
{ key: 'value' },
'/api/test'
'/api/test',
);

expect(renderResult.result.current[0]).toBe(EnableApplicationStatus.IDLE);
expect(renderResult.result.current[1]).toBe('');

await renderResult.waitForNextUpdate();

expect(enableIntegrationApp).toHaveBeenCalledWith(
'/api/test',
{ key: 'value' }
);
expect(getIntegrationAppEnablementStatus).toHaveBeenCalledWith(
'/api/test'
);
expect(enableIntegrationApp).toHaveBeenCalledWith('/api/test', { key: 'value' });
expect(getIntegrationAppEnablementStatus).toHaveBeenCalledWith('/api/test');
});

it('should handle API errors', async () => {
Expand All @@ -108,7 +106,7 @@ describe('useEnableApplication', () => {
'test-app',
'Test App',
{ key: 'value' },
'/api/test'
'/api/test',
);

expect(renderResult.result.current[0]).toBe(EnableApplicationStatus.IDLE);
Expand All @@ -128,7 +126,7 @@ describe('useEnableApplication', () => {
'test-app',
'Test App',
{},
undefined
undefined,
);

expect(renderResult.result.current[0]).toBe(EnableApplicationStatus.IDLE);
Expand All @@ -138,4 +136,4 @@ describe('useEnableApplication', () => {
expect(renderResult.result.current[0]).toBe(EnableApplicationStatus.IDLE);
expect(renderResult.result.current[1]).toBe('');
});
});
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useWatchIntegrationComponents } from '../useWatchIntegrationComponents';
import { getIntegrationAppEnablementStatus } from '~/services/integrationAppService';
import { OdhApplication, VariablesValidationStatus } from '~/types';
import { testHook } from '~/__tests__/unit/testUtils/hooks';
import * as reduxHooks from '~/redux/hooks';
import { useWatchIntegrationComponents } from '~/utilities/useWatchIntegrationComponents';

jest.mock('~/services/integrationAppService', () => ({
getIntegrationAppEnablementStatus: jest.fn(),
Expand Down Expand Up @@ -110,4 +110,4 @@ describe('useWatchIntegrationComponents', () => {

expect(renderResult.result.current.checkedComponents[0].spec.isEnabled).toBe(true);
});
});
});

0 comments on commit 40cc26d

Please sign in to comment.