diff --git a/src/hooks/useDynamicImportJSON/__tests__/useDynamicImport.test.tsx b/src/hooks/useDynamicImportJSON/__tests__/useDynamicImport.test.tsx index 91523839c..009230dd5 100644 --- a/src/hooks/useDynamicImportJSON/__tests__/useDynamicImport.test.tsx +++ b/src/hooks/useDynamicImportJSON/__tests__/useDynamicImport.test.tsx @@ -1,24 +1,24 @@ -import React from "react"; -import "@testing-library/jest-dom"; -import userEvent from "@testing-library/user-event"; -import { renderHook } from "@testing-library/react-hooks"; -import { act } from "react-dom/test-utils"; -import useDynamicImportJSON from ".."; -import { cleanup, render, screen } from "@testing-library/react"; - -jest.mock("@docusaurus/router", () => ({ +import React from 'react'; +import '@testing-library/jest-dom'; +import userEvent from '@testing-library/user-event'; +import { renderHook } from '@testing-library/react-hooks'; +import { act } from 'react-dom/test-utils'; +import useDynamicImportJSON from '..'; +import { cleanup, render, screen } from '@testing-library/react'; + +jest.mock('@docusaurus/router', () => ({ useLocation: () => ({ - pathname: "/api-explorer#active_symbols", - hash: "#active_symbols", + pathname: '/api-explorer#active_symbols', + hash: '#active_symbols', }), useHistory: () => ({ push: jest.fn(), }), })); -jest.mock("@site/src/hooks/useAuthContext"); +jest.mock('@site/src/hooks/useAuthContext'); -describe("useDynamicImportJSON", () => { +describe('useDynamicImportJSON', () => { const { result } = renderHook(() => useDynamicImportJSON()); afterEach(() => { @@ -26,61 +26,52 @@ describe("useDynamicImportJSON", () => { cleanup(); }); - it("should populate text data with the correct values", () => { + it('should populate text data with the correct values', () => { act(() => { expect(result.current.text_data).toEqual({ - request: - '{\n "active_symbols": "brief",\n "product_type": "basic"\n}', - selected_value: "Active Symbols", - name: "active_symbols", + request: '{\n "active_symbols": "brief",\n "product_type": "basic"\n}', + selected_value: 'Active Symbols', + name: 'active_symbols', }); }); }); - it("should be able to call handleTextAreaInput when typing in a textarea", async () => { - const spyHandleInputFunction = jest.spyOn( - result.current, - "handleTextAreaInput" - ); + it('should be able to call handleTextAreaInput when typing in a textarea', async () => { + const spyHandleInputFunction = jest.spyOn(result.current, 'handleTextAreaInput'); - render( -