diff --git a/ui-v2/src/hooks/deployments/deployments.test.tsx b/ui-v2/src/hooks/deployments/deployments.test.tsx index bb5b365bf6d9..e69cebd12f8b 100644 --- a/ui-v2/src/hooks/deployments/deployments.test.tsx +++ b/ui-v2/src/hooks/deployments/deployments.test.tsx @@ -5,11 +5,11 @@ import { describe, expect, it } from "vitest"; import { type Deployment, - usePaginateDeployments, useCountDeployments, + usePaginateDeployments, } from "./index"; -import { server } from "../../../tests/mocks/node"; +import { server } from "@tests/mocks"; describe("deployments hooks", () => { const seedDeployments = (): Deployment[] => [ diff --git a/ui-v2/src/hooks/global-concurrency-limits.test.tsx b/ui-v2/src/hooks/global-concurrency-limits.test.tsx index cd94a8f47ab0..cad75265bb6e 100644 --- a/ui-v2/src/hooks/global-concurrency-limits.test.tsx +++ b/ui-v2/src/hooks/global-concurrency-limits.test.tsx @@ -1,5 +1,6 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { act, renderHook, waitFor } from "@testing-library/react"; +import { server } from "@tests/mocks"; import { http, HttpResponse } from "msw"; import { describe, expect, it } from "vitest"; @@ -12,8 +13,6 @@ import { useUpdateGlobalConcurrencyLimit, } from "./global-concurrency-limits"; -import { server } from "../../tests/mocks/node"; - describe("global concurrency limits hooks", () => { const seedGlobalConcurrencyLimits = () => [ { diff --git a/ui-v2/src/hooks/variables.test.tsx b/ui-v2/src/hooks/variables.test.tsx index ba104cbfc430..884a36860074 100644 --- a/ui-v2/src/hooks/variables.test.tsx +++ b/ui-v2/src/hooks/variables.test.tsx @@ -4,6 +4,7 @@ import { http, HttpResponse } from "msw"; import { describe, expect, it } from "vitest"; import { components } from "@/api/prefect"; +import { server } from "@tests/mocks"; import { buildCountQuery, @@ -14,8 +15,6 @@ import { useVariables, } from "./variables"; -import { server } from "../../tests/mocks/node"; - describe("variable hooks", () => { const seedVariables = () => [ { diff --git a/ui-v2/tests/mocks/index.ts b/ui-v2/tests/mocks/index.ts new file mode 100644 index 000000000000..a145bd6f8360 --- /dev/null +++ b/ui-v2/tests/mocks/index.ts @@ -0,0 +1 @@ +export { server } from "./node"; diff --git a/ui-v2/tests/setup.ts b/ui-v2/tests/setup.ts index 93009dff1683..1cb5018a8282 100644 --- a/ui-v2/tests/setup.ts +++ b/ui-v2/tests/setup.ts @@ -1,9 +1,9 @@ /// -import { expect, afterEach, vi, beforeAll, afterAll } from "vitest"; -import { cleanup } from "@testing-library/react"; import * as matchers from "@testing-library/jest-dom/matchers"; +import { cleanup } from "@testing-library/react"; +import { afterAll, afterEach, beforeAll, expect, vi } from "vitest"; import "@testing-library/jest-dom"; -import { server } from "./mocks/node"; +import { server } from "./mocks"; beforeAll(() => { server.listen({ diff --git a/ui-v2/tests/variables/variables.test.tsx b/ui-v2/tests/variables/variables.test.tsx index 0701e268888f..4d72ba1e2208 100644 --- a/ui-v2/tests/variables/variables.test.tsx +++ b/ui-v2/tests/variables/variables.test.tsx @@ -1,4 +1,9 @@ import "./mocks"; +import { Toaster } from "@/components/ui/toaster"; +import { VariablesDataTable } from "@/components/variables/data-table"; +import { router } from "@/router"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { RouterProvider } from "@tanstack/react-router"; import { getByLabelText, getByTestId, @@ -6,24 +11,18 @@ import { render, screen, } from "@testing-library/react"; -import { VariablesDataTable } from "@/components/variables/data-table"; import userEvent from "@testing-library/user-event"; +import { server } from "@tests/mocks"; +import { http, HttpResponse } from "msw"; import { + afterEach, + beforeAll, + beforeEach, describe, - it, expect, + it, vi, - afterEach, - beforeEach, - beforeAll, } from "vitest"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { Toaster } from "@/components/ui/toaster"; -import { server } from "../mocks/node"; -import { HttpResponse } from "msw"; -import { http } from "msw"; -import { router } from "@/router"; -import { RouterProvider } from "@tanstack/react-router"; const renderVariablesPage = async () => { const user = userEvent.setup(); diff --git a/ui-v2/tsconfig.app.json b/ui-v2/tsconfig.app.json index 2642b700885a..f2cb1ee0f02c 100644 --- a/ui-v2/tsconfig.app.json +++ b/ui-v2/tsconfig.app.json @@ -7,7 +7,8 @@ "skipLibCheck": true, "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "@tests/*": ["./tests/*"] }, "moduleResolution": "bundler", "allowImportingTsExtensions": true, diff --git a/ui-v2/tsconfig.json b/ui-v2/tsconfig.json index 827701bce8d9..436b934cbf1a 100644 --- a/ui-v2/tsconfig.json +++ b/ui-v2/tsconfig.json @@ -11,7 +11,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "@tests/*": ["./tests/*"] } } } diff --git a/ui-v2/vite.config.ts b/ui-v2/vite.config.ts index 799c680a2c79..22ce08c1660c 100644 --- a/ui-v2/vite.config.ts +++ b/ui-v2/vite.config.ts @@ -14,6 +14,7 @@ export default defineConfig({ resolve: { alias: { "@": path.resolve(__dirname, "./src"), + "@tests": path.resolve(__dirname, "./tests"), }, }, });