Skip to content

Commit

Permalink
Revert "ADM-777:[frontend]refactor: fix code style for code lint"
Browse files Browse the repository at this point in the history
This reverts commit 7e7dd75.
  • Loading branch information
weiraneve committed Feb 1, 2024
1 parent 7e7dd75 commit 350b592
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
11 changes: 6 additions & 5 deletions frontend/__tests__/hooks/useGetMetricsStepsEffect.test.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { ContextProvider } from '@src/hooks/useMetricsStepValidationCheckContext';
import { InternalServerException } from '@src/exceptions/InternalServerException';
import { ERROR_MESSAGE_TIME_DURATION, MOCK_GET_STEPS_PARAMS } from '../fixtures';
import { useGetMetricsStepsEffect } from '@src/hooks/useGetMetricsStepsEffect';
import { metricsClient } from '@src/clients/MetricsClient';
import { act, renderHook } from '@testing-library/react';
import { setupStore } from '@test/utils/setupStoreUtil';
import { Provider } from 'react-redux';
import { HttpStatusCode } from 'axios';
import {setupStore} from "@test/utils/setupStoreUtil";
import {Provider} from "react-redux";
import {ContextProvider} from "@src/hooks/useMetricsStepValidationCheckContext";
import React from "react";

const setup = () => {
const store = setupStore();
const wrapper = ({ children }: { children: React.ReactNode }) => (
const wrapper = ({children}: { children: React.ReactNode }) => (
<Provider store={store}>
<ContextProvider>{children}</ContextProvider>
</Provider>
);
return renderHook(() => useGetMetricsStepsEffect(), { wrapper });
return renderHook(() => useGetMetricsStepsEffect(), {wrapper});
};

describe('use get steps effect', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useGetPipelineToolInfoEffect } from '@src/hooks/useGetPipelineToolInfoEffect';
import { updatePipelineToolShouldCallInfoApi } from '@src/context/config/configSlice';
import { pipelineToolClient } from '@src/clients/pipeline/PipelineToolClient';
import { MOCK_BUILD_KITE_GET_INFO_RESPONSE } from '../fixtures';
import { renderHook, waitFor } from '@testing-library/react';
import { setupStore } from '../utils/setupStoreUtil';
import { act } from 'react-dom/test-utils';
import { Provider } from 'react-redux';
import { HttpStatusCode } from 'axios';
import { ReactNode } from 'react';
import React from 'react';
import {act} from "react-dom/test-utils";
import { updatePipelineToolShouldCallInfoApi } from "@src/context/config/configSlice";

const mockDispatch = jest.fn();
jest.mock('react-redux', () => ({
Expand Down Expand Up @@ -50,15 +50,15 @@ beforeEach(() => {
describe('use get pipelineTool info side effect', () => {
it('should return immediately if shouldCallApi is false', async () => {
const store = setupStore();
const Wrapper = ({ children }: { children: ReactNode }) => {
const Wrapper = ({children}: { children: ReactNode }) => {
return <Provider store={store}>{children}</Provider>;
};

act(() => {
store.dispatch(updatePipelineToolShouldCallInfoApi(false));
});

const { result } = renderHook(() => useGetPipelineToolInfoEffect(), { wrapper: Wrapper });
const {result} = renderHook(() => useGetPipelineToolInfoEffect(), {wrapper: Wrapper});

act(() => {
result.current.apiCallFunc();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { ButtonWrapper, PipelineMetricSelectionWrapper, RemoveButton, WarningMes
import { WarningNotification } from '@src/components/Common/WarningNotification';
import { useGetMetricsStepsEffect } from '@src/hooks/useGetMetricsStepsEffect';
import { ErrorNotification } from '@src/components/ErrorNotification';
import { useAppDispatch, useAppSelector } from '@src/hooks';
import { MESSAGE } from '@src/constants/resources';
import { Loading } from '@src/components/Loading';
import { useAppDispatch, useAppSelector} from '@src/hooks';
import { store } from '@src/store';
import { useState } from 'react';

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/hooks/useGetMetricsStepsEffect.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { shouldCallStepApi, updatePipelineToolShouldCallStepApi } from '@src/context/config/configSlice';
import { getStepsParams, metricsClient } from '@src/clients/MetricsClient';
import { useAppDispatch, useAppSelector } from '@src/hooks/index';
import { MESSAGE } from '@src/constants/resources';
import { DURATION } from '@src/constants/commons';
import { useState } from 'react';
import { shouldCallStepApi, updatePipelineToolShouldCallStepApi } from "@src/context/config/configSlice";
import { useAppDispatch, useAppSelector } from "@src/hooks/index";

export interface useGetMetricsStepsEffectInterface {
getSteps: (
Expand Down

0 comments on commit 350b592

Please sign in to comment.