From 6a68fb16b5a73501070cfb0ffc107d77aa7db142 Mon Sep 17 00:00:00 2001 From: Ayobami Akingbade Date: Mon, 27 May 2024 18:07:29 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(typings):=20use?= =?UTF-8?q?=20.d.ts=20file=20for=20typings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jest.config.ts | 2 +- src/__tests__/_/Provider.tsx | 10 ++ src/__tests__/_/api-handlers/config.ts | 2 +- src/__tests__/_/forCodeCoverage.spec.ts | 107 ------------------ .../variables__credentials.spec.tsx | 20 ++-- src/backend/data/{types.ts => types.d.ts} | 2 - .../libs/mailgun/{types.ts => types.d.ts} | 2 - .../libs/postmark/{types.ts => types.d.ts} | 2 - .../libs/sendgrid/{types.ts => types.d.ts} | 2 - .../libs/sendinblue/{types.ts => types.d.ts} | 2 - .../libs/slack/{types.ts => types.d.ts} | 2 - .../libs/smtp/{types.ts => types.d.ts} | 2 - .../libs/twilio/{types.ts => types.d.ts} | 2 - .../lib/config-persistence/portal/index.ts | 2 - .../portal/main/{types.ts => types.d.ts} | 2 - .../key-value/portal/{index.ts => index.d.ts} | 2 - .../key-value/portal/{main.ts => main.d.ts} | 2 - .../implementations/{types.ts => types.d.ts} | 2 - .../validations/{types.ts => types.d.ts} | 2 - src/backend/menu/{types.ts => types.d.ts} | 2 - src/backend/storage/{types.ts => types.d.ts} | 2 - .../SchemaForm/{types.ts => types.d.ts} | 2 - .../Button/{types.ts => types.d.ts} | 2 - .../EmptyWrapper/{types.ts => types.d.ts} | 2 - .../components/Form/{types.ts => types.d.ts} | 2 - .../IntermediateCheckBox.spec.tsx | 42 +++++++ .../components/IntermediateCheckBox/index.tsx | 13 +-- .../Table/filters/{types.ts => types.d.ts} | 2 - .../theme/{types.ts => types.d.ts} | 2 - .../lib/crud-config/{types.ts => types.d.ts} | 2 - .../data/useMutate/{types.ts => types.d.ts} | 2 - .../lib/form/{types.ts => types.d.ts} | 2 - .../WidgetHeader/{types.ts => types.d.ts} | 2 - .../Widget/_manage/{types.ts => types.d.ts} | 2 - .../Dashboard/Widget/{types.ts => types.d.ts} | 2 - .../{base-types.ts => base-types.d.ts} | 2 - .../portal/menu/{index.ts => index.d.ts} | 2 - .../portal/menu/{main.ts => main.d.ts} | 2 - .../roles/permissions/{base.ts => base.d.ts} | 2 - .../form-schemas/{types.ts => types.d.ts} | 2 - .../users/{index.ts => index.d.ts} | 2 - .../types/auth/{index.ts => index.d.ts} | 2 - .../auth/portal/{index.ts => index.d.ts} | 2 - .../types/auth/portal/{main.ts => main.d.ts} | 2 - .../types/dashboard/{base.ts => base.d.ts} | 2 - src/shared/types/data.ts | 2 - src/shared/types/{db.ts => db.d.ts} | 2 - src/shared/types/{options.ts => options.d.ts} | 2 - .../portal/widgets/{index.ts => index.d.ts} | 2 - .../widgets/main/{index.ts => index.d.ts} | 2 - src/shared/types/{roles.ts => roles.d.ts} | 2 - src/shared/types/{ui.ts => ui.d.ts} | 2 - .../{base-types.ts => base-types.d.ts} | 2 - src/shared/user-preferences/types.ts | 2 - .../validations/{types.ts => types.d.ts} | 2 - 55 files changed, 65 insertions(+), 227 deletions(-) delete mode 100644 src/__tests__/_/forCodeCoverage.spec.ts rename src/backend/data/{types.ts => types.d.ts} (97%) rename src/backend/integrations/libs/mailgun/{types.ts => types.d.ts} (68%) rename src/backend/integrations/libs/postmark/{types.ts => types.d.ts} (63%) rename src/backend/integrations/libs/sendgrid/{types.ts => types.d.ts} (61%) rename src/backend/integrations/libs/sendinblue/{types.ts => types.d.ts} (61%) rename src/backend/integrations/libs/slack/{types.ts => types.d.ts} (60%) rename src/backend/integrations/libs/smtp/{types.ts => types.d.ts} (77%) rename src/backend/integrations/libs/twilio/{types.ts => types.d.ts} (70%) rename src/backend/lib/config-persistence/portal/main/{types.ts => types.d.ts} (53%) rename src/backend/lib/key-value/portal/{index.ts => index.d.ts} (61%) rename src/backend/lib/key-value/portal/{main.ts => main.d.ts} (54%) rename src/backend/lib/request/validations/implementations/{types.ts => types.d.ts} (88%) rename src/backend/lib/request/validations/{types.ts => types.d.ts} (94%) rename src/backend/menu/{types.ts => types.d.ts} (89%) rename src/backend/storage/{types.ts => types.d.ts} (89%) rename src/frontend/components/SchemaForm/{types.ts => types.d.ts} (96%) rename src/frontend/design-system/components/Button/{types.ts => types.d.ts} (95%) rename src/frontend/design-system/components/EmptyWrapper/{types.ts => types.d.ts} (85%) rename src/frontend/design-system/components/Form/{types.ts => types.d.ts} (94%) create mode 100644 src/frontend/design-system/components/IntermediateCheckBox/IntermediateCheckBox.spec.tsx rename src/frontend/design-system/components/Table/filters/{types.ts => types.d.ts} (82%) rename src/frontend/design-system/theme/{types.ts => types.d.ts} (91%) rename src/frontend/lib/crud-config/{types.ts => types.d.ts} (82%) rename src/frontend/lib/data/useMutate/{types.ts => types.d.ts} (94%) rename src/frontend/lib/form/{types.ts => types.d.ts} (77%) rename src/frontend/views/Dashboard/Widget/_components/WidgetHeader/{types.ts => types.d.ts} (72%) rename src/frontend/views/Dashboard/Widget/_manage/{types.ts => types.d.ts} (79%) rename src/frontend/views/Dashboard/Widget/{types.ts => types.d.ts} (93%) rename src/shared/configurations/{base-types.ts => base-types.d.ts} (96%) rename src/shared/constants/portal/menu/{index.ts => index.d.ts} (57%) rename src/shared/constants/portal/menu/{main.ts => main.d.ts} (50%) rename src/shared/form-schemas/roles/permissions/{base.ts => base.d.ts} (66%) rename src/shared/form-schemas/{types.ts => types.d.ts} (97%) rename src/shared/form-schemas/users/{index.ts => index.d.ts} (84%) rename src/shared/types/auth/{index.ts => index.d.ts} (72%) rename src/shared/types/auth/portal/{index.ts => index.d.ts} (67%) rename src/shared/types/auth/portal/{main.ts => main.d.ts} (69%) rename src/shared/types/dashboard/{base.ts => base.d.ts} (88%) rename src/shared/types/{db.ts => db.d.ts} (95%) rename src/shared/types/{options.ts => options.d.ts} (92%) rename src/shared/types/portal/widgets/{index.ts => index.d.ts} (61%) rename src/shared/types/portal/widgets/main/{index.ts => index.d.ts} (86%) rename src/shared/types/{roles.ts => roles.d.ts} (66%) rename src/shared/types/{ui.ts => ui.d.ts} (94%) rename src/shared/user-preferences/{base-types.ts => base-types.d.ts} (59%) rename src/shared/validations/{types.ts => types.d.ts} (97%) diff --git a/jest.config.ts b/jest.config.ts index 726653191..b2e3574df 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -10,7 +10,7 @@ const customJestConfig = { coverageProvider: "v8", - collectCoverageFrom: ["src/**/*.{ts,tsx}", "!**/Stories.tsx"], + collectCoverageFrom: ["src/**/*.{ts,tsx}", "!**/Stories.tsx", "!**/.d.ts"], moduleDirectories: ["node_modules", "src"], diff --git a/src/__tests__/_/Provider.tsx b/src/__tests__/_/Provider.tsx index 336839dcc..a09b9de55 100644 --- a/src/__tests__/_/Provider.tsx +++ b/src/__tests__/_/Provider.tsx @@ -17,6 +17,16 @@ const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: Infinity, + retry: (failureCount, error: any) => { + const statusCode = (error as Response)?.status; + if (!statusCode) { + return true; + } + if (`${statusCode}`.startsWith("4")) { + return false; + } + return failureCount < 3; + }, }, }, }); diff --git a/src/__tests__/_/api-handlers/config.ts b/src/__tests__/_/api-handlers/config.ts index a6e79b1d7..49dcbcb78 100644 --- a/src/__tests__/_/api-handlers/config.ts +++ b/src/__tests__/_/api-handlers/config.ts @@ -1,5 +1,5 @@ import { rest } from "msw"; -import { FilterOperators, ITableView } from "shared/types/data"; +import { ITableView, FilterOperators } from "shared/types/data"; import { BASE_TEST_URL } from "./_utils"; const ENTITY_CONFIG = {}; diff --git a/src/__tests__/_/forCodeCoverage.spec.ts b/src/__tests__/_/forCodeCoverage.spec.ts deleted file mode 100644 index 40df3b091..000000000 --- a/src/__tests__/_/forCodeCoverage.spec.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { FOR_CODE_COV as $1 } from "backend/lib/request/validations/types"; -import { FOR_CODE_COV as $2 } from "frontend/lib/crud-config/types"; -import { FOR_CODE_COV as $3 } from "shared/form-schemas/types"; -import { FOR_CODE_COV as $4 } from "shared/validations/types"; -import { FOR_CODE_COV as $5 } from "shared/types/options"; -import { FOR_CODE_COV as $6 } from "shared/types/auth"; -import { FOR_CODE_COV as $7 } from "shared/types/data"; -import { FOR_CODE_COV as $8 } from "shared/types/db"; -import { FOR_CODE_COV as $9 } from "shared/types/ui"; -import { FOR_CODE_COV as $10 } from "backend/data/types"; -import { FOR_CODE_COV as $11 } from "backend/lib/request/validations/implementations/types"; -import { FOR_CODE_COV as $12 } from "backend/integrations/libs/mailgun/types"; -import { FOR_CODE_COV as $13 } from "backend/integrations/libs/postmark/types"; -import { FOR_CODE_COV as $14 } from "backend/integrations/libs/sendgrid/types"; -import { FOR_CODE_COV as $15 } from "backend/integrations/libs/sendinblue/types"; -import { FOR_CODE_COV as $16 } from "backend/integrations/libs/slack/types"; -import { FOR_CODE_COV as $17 } from "backend/integrations/libs/smtp/types"; -import { FOR_CODE_COV as $18 } from "backend/integrations/libs/twilio/types"; -import { FOR_CODE_COV as $19 } from "backend/storage/types"; -import { FOR_CODE_COV as $20 } from "frontend/design-system/theme/types"; -import { FOR_CODE_COV as $21 } from "shared/form-schemas/roles/permissions/base"; -import { FOR_CODE_COV as $22 } from "backend/lib/config-persistence/portal/index"; -import { FOR_CODE_COV as $23 } from "backend/lib/config-persistence/portal/main/types"; -import { FOR_CODE_COV as $24 } from "frontend/views/Dashboard/Widget/types"; -import { FOR_CODE_COV as $25 } from "shared/types/auth/portal/index"; -import { FOR_CODE_COV as $26 } from "shared/types/auth/portal/main"; -import { FOR_CODE_COV as $28 } from "shared/types/portal/widgets/main"; -import { FOR_CODE_COV as $29 } from "shared/types/portal/widgets"; -import { FOR_CODE_COV as $30 } from "backend/lib/key-value/portal/index"; -import { FOR_CODE_COV as $31 } from "backend/lib/key-value/portal/main"; -import { FOR_CODE_COV as $32 } from "shared/configurations/base-types"; -import { FOR_CODE_COV as $33 } from "frontend/views/Dashboard/Widget/_components/WidgetHeader/types"; -import { FOR_CODE_COV as $35 } from "shared/types/roles"; -import { FOR_CODE_COV as $37 } from "frontend/views/Dashboard/Widget/_manage/types"; -import { FOR_CODE_COV as $39 } from "shared/types/dashboard/base"; -import { FOR_CODE_COV as $40 } from "frontend/lib/data/useMutate/types"; -import { FOR_CODE_COV as $41 } from "frontend/design-system/components/Form/types"; -import { FOR_CODE_COV as $42 } from "backend/menu/types"; -import { FOR_CODE_COV as $43 } from "frontend/lib/form/types"; -import { FOR_CODE_COV as $44 } from "frontend/design-system/components/Table/filters/types"; -import { FOR_CODE_COV as $45 } from "shared/form-schemas/users"; -import { FOR_CODE_COV as $46 } from "shared/constants/portal/menu/main"; -import { FOR_CODE_COV as $47 } from "shared/constants/portal/menu/index"; -import { FOR_CODE_COV as $48 } from "shared/user-preferences/base-types"; -import { FOR_CODE_COV as $49 } from "shared/user-preferences/types"; -import { FOR_CODE_COV as $50 } from "frontend/design-system/components/EmptyWrapper/types"; -import { FOR_CODE_COV as $51 } from "frontend/components/SchemaForm/types"; -import { FOR_CODE_COV as $52 } from "frontend/design-system/components/Button/types"; - -import { noop } from "shared/lib/noop"; - -noop( - $1, - $2, - $3, - $4, - $5, - $6, - $7, - $8, - $9, - $10, - $11, - $12, - $13, - $14, - $15, - $16, - $17, - $18, - $19, - $20, - $21, - $22, - $23, - $24, - $25, - $26, - $28, - $29, - $30, - $31, - $32, - $33, - $35, - $37, - $39, - $40, - $41, - $42, - $43, - $44, - $45, - $46, - $47, - $48, - $49, - $50, - $51, - $52 -); - -describe("Code coverage ignores plain types file", () => { - it("should be run once to be counted", () => { - expect(1).toBe(1); - }); -}); diff --git a/src/__tests__/integrations/variables__credentials.spec.tsx b/src/__tests__/integrations/variables__credentials.spec.tsx index b0796f472..2e39f250e 100644 --- a/src/__tests__/integrations/variables__credentials.spec.tsx +++ b/src/__tests__/integrations/variables__credentials.spec.tsx @@ -13,7 +13,7 @@ import { TestProviders } from "__tests__/_/Provider"; setupApiHandlers(); -describe.skip("pages/integrations/variables => credentials", () => { +describe("pages/integrations/variables => credentials", () => { const useRouter = jest.spyOn(require("next/router"), "useRouter"); beforeAll(() => { localStorage.setItem(AuthActions.JWT_TOKEN_STORAGE_KEY, "foo"); @@ -40,7 +40,7 @@ describe.skip("pages/integrations/variables => credentials", () => { expect( within(priviledgeSection).queryByText( - `For security reasons, Please input your account password to be able to manage Secrets` + `For security reasons, Please input your account password to reveal credentials` ) ).not.toBeInTheDocument(); expect( @@ -53,7 +53,7 @@ describe.skip("pages/integrations/variables => credentials", () => { ).not.toBeInTheDocument(); expect( within(priviledgeSection).queryByRole(`button`, { - name: "Reveal Secrets", + name: "Reveal Credentials", }) ).not.toBeInTheDocument(); }); @@ -71,7 +71,7 @@ describe.skip("pages/integrations/variables => credentials", () => { await userEvent.click(screen.getByRole("tab", { name: "Secrets" })); expect( within(priviledgeSection).getByText( - `For security reasons, Please input your account password to be able to manage Secrets` + `For security reasons, Please input your account password to reveal credentials` ) ).toBeInTheDocument(); expect( @@ -84,7 +84,7 @@ describe.skip("pages/integrations/variables => credentials", () => { ).toBeInTheDocument(); expect( within(priviledgeSection).getByRole(`button`, { - name: "Reveal Secrets", + name: "Reveal Credentials", }) ).toBeInTheDocument(); }); @@ -169,7 +169,7 @@ describe.skip("pages/integrations/variables => credentials", () => { ); await userEvent.click( within(priviledgeSection).getByRole("button", { - name: "Reveal Secrets", + name: "Reveal Credentials", }) ); @@ -215,7 +215,7 @@ describe.skip("pages/integrations/variables => credentials", () => { ); await userEvent.click( within(priviledgeSection).getByRole("button", { - name: "Reveal Secrets", + name: "Reveal Credentials", }) ); @@ -236,7 +236,7 @@ describe.skip("pages/integrations/variables => credentials", () => { expect( within(priviledgeSection).queryByText( - `For security reasons, Please input your account password to be able to manage Secrets` + `For security reasons, Please input your account password to reveal credentials` ) ).not.toBeInTheDocument(); expect( @@ -244,7 +244,7 @@ describe.skip("pages/integrations/variables => credentials", () => { ).not.toBeInTheDocument(); expect( within(priviledgeSection).queryByRole(`button`, { - name: "Reveal Secrets", + name: "Reveal Credentials", }) ).not.toBeInTheDocument(); }); @@ -281,7 +281,7 @@ describe.skip("pages/integrations/variables => credentials", () => { }); }); - describe("update", () => { + describe.skip("update", () => { it("should update secret", async () => { render( diff --git a/src/backend/data/types.ts b/src/backend/data/types.d.ts similarity index 97% rename from src/backend/data/types.ts rename to src/backend/data/types.d.ts index 76eebb352..d16e889c3 100644 --- a/src/backend/data/types.ts +++ b/src/backend/data/types.d.ts @@ -8,8 +8,6 @@ export interface IPaginationFilters { sortBy?: string; } -export const FOR_CODE_COV = 1; - export interface IDataApiService { fetchData( entity: string, diff --git a/src/backend/integrations/libs/mailgun/types.ts b/src/backend/integrations/libs/mailgun/types.d.ts similarity index 68% rename from src/backend/integrations/libs/mailgun/types.ts rename to src/backend/integrations/libs/mailgun/types.d.ts index 72e5759db..a4b499d3c 100644 --- a/src/backend/integrations/libs/mailgun/types.ts +++ b/src/backend/integrations/libs/mailgun/types.d.ts @@ -2,5 +2,3 @@ export type IActionConfig = { apiKey: string; domain: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/integrations/libs/postmark/types.ts b/src/backend/integrations/libs/postmark/types.d.ts similarity index 63% rename from src/backend/integrations/libs/postmark/types.ts rename to src/backend/integrations/libs/postmark/types.d.ts index 1f60ab0d4..f186f75e3 100644 --- a/src/backend/integrations/libs/postmark/types.ts +++ b/src/backend/integrations/libs/postmark/types.d.ts @@ -1,5 +1,3 @@ export type IActionConfig = { serverToken: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/integrations/libs/sendgrid/types.ts b/src/backend/integrations/libs/sendgrid/types.d.ts similarity index 61% rename from src/backend/integrations/libs/sendgrid/types.ts rename to src/backend/integrations/libs/sendgrid/types.d.ts index d40b0dbda..3e9157b97 100644 --- a/src/backend/integrations/libs/sendgrid/types.ts +++ b/src/backend/integrations/libs/sendgrid/types.d.ts @@ -1,5 +1,3 @@ export type IActionConfig = { apiKey: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/integrations/libs/sendinblue/types.ts b/src/backend/integrations/libs/sendinblue/types.d.ts similarity index 61% rename from src/backend/integrations/libs/sendinblue/types.ts rename to src/backend/integrations/libs/sendinblue/types.d.ts index d40b0dbda..3e9157b97 100644 --- a/src/backend/integrations/libs/sendinblue/types.ts +++ b/src/backend/integrations/libs/sendinblue/types.d.ts @@ -1,5 +1,3 @@ export type IActionConfig = { apiKey: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/integrations/libs/slack/types.ts b/src/backend/integrations/libs/slack/types.d.ts similarity index 60% rename from src/backend/integrations/libs/slack/types.ts rename to src/backend/integrations/libs/slack/types.d.ts index 64c95a5a8..687af2ee4 100644 --- a/src/backend/integrations/libs/slack/types.ts +++ b/src/backend/integrations/libs/slack/types.d.ts @@ -1,5 +1,3 @@ export type IActionConfig = { token: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/integrations/libs/smtp/types.ts b/src/backend/integrations/libs/smtp/types.d.ts similarity index 77% rename from src/backend/integrations/libs/smtp/types.ts rename to src/backend/integrations/libs/smtp/types.d.ts index d18da5a80..17c74b332 100644 --- a/src/backend/integrations/libs/smtp/types.ts +++ b/src/backend/integrations/libs/smtp/types.d.ts @@ -4,5 +4,3 @@ export type IActionConfig = { authUser: string; authPassword: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/integrations/libs/twilio/types.ts b/src/backend/integrations/libs/twilio/types.d.ts similarity index 70% rename from src/backend/integrations/libs/twilio/types.ts rename to src/backend/integrations/libs/twilio/types.d.ts index 82088b3d6..a66046379 100644 --- a/src/backend/integrations/libs/twilio/types.ts +++ b/src/backend/integrations/libs/twilio/types.d.ts @@ -2,5 +2,3 @@ export type IActionConfig = { authToken: string; accountSid: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/lib/config-persistence/portal/index.ts b/src/backend/lib/config-persistence/portal/index.ts index e6aedf252..f4740960b 100644 --- a/src/backend/lib/config-persistence/portal/index.ts +++ b/src/backend/lib/config-persistence/portal/index.ts @@ -1,5 +1,3 @@ export type { PortalConfigDomain } from "./main/types"; -export const FOR_CODE_COV = 1; - export { updateMetaData, createMetaData } from "./main"; diff --git a/src/backend/lib/config-persistence/portal/main/types.ts b/src/backend/lib/config-persistence/portal/main/types.d.ts similarity index 53% rename from src/backend/lib/config-persistence/portal/main/types.ts rename to src/backend/lib/config-persistence/portal/main/types.d.ts index 1b854c3c4..c7756b07e 100644 --- a/src/backend/lib/config-persistence/portal/main/types.ts +++ b/src/backend/lib/config-persistence/portal/main/types.d.ts @@ -1,3 +1 @@ export type PortalConfigDomain = ""; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/lib/key-value/portal/index.ts b/src/backend/lib/key-value/portal/index.d.ts similarity index 61% rename from src/backend/lib/key-value/portal/index.ts rename to src/backend/lib/key-value/portal/index.d.ts index af2095d87..a4f7a39eb 100644 --- a/src/backend/lib/key-value/portal/index.ts +++ b/src/backend/lib/key-value/portal/index.d.ts @@ -1,3 +1 @@ export { type PortalKeyValueDomain } from "./main"; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/lib/key-value/portal/main.ts b/src/backend/lib/key-value/portal/main.d.ts similarity index 54% rename from src/backend/lib/key-value/portal/main.ts rename to src/backend/lib/key-value/portal/main.d.ts index fdd3614d0..91aa75093 100644 --- a/src/backend/lib/key-value/portal/main.ts +++ b/src/backend/lib/key-value/portal/main.d.ts @@ -1,3 +1 @@ export type PortalKeyValueDomain = ""; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/lib/request/validations/implementations/types.ts b/src/backend/lib/request/validations/implementations/types.d.ts similarity index 88% rename from src/backend/lib/request/validations/implementations/types.ts rename to src/backend/lib/request/validations/implementations/types.d.ts index 575d2e7f6..aeeb28e65 100644 --- a/src/backend/lib/request/validations/implementations/types.ts +++ b/src/backend/lib/request/validations/implementations/types.d.ts @@ -5,5 +5,3 @@ export type ValidationImplType = ( req: NextApiRequest & { user?: IAccountProfile }, config?: unknown ) => Promise; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/lib/request/validations/types.ts b/src/backend/lib/request/validations/types.d.ts similarity index 94% rename from src/backend/lib/request/validations/types.ts rename to src/backend/lib/request/validations/types.d.ts index 36592ecb4..414e1e429 100644 --- a/src/backend/lib/request/validations/types.ts +++ b/src/backend/lib/request/validations/types.d.ts @@ -22,5 +22,3 @@ export type ValidationKeys = { method?: RequestMethod[]; body?: unknown; }; - -export const FOR_CODE_COV = 1; diff --git a/src/backend/menu/types.ts b/src/backend/menu/types.d.ts similarity index 89% rename from src/backend/menu/types.ts rename to src/backend/menu/types.d.ts index 966300988..17db2bd3f 100644 --- a/src/backend/menu/types.ts +++ b/src/backend/menu/types.d.ts @@ -7,5 +7,3 @@ export interface IBaseNavigationMenuApiService { navItems: INavigationMenuItem[] ): Promise; } - -export const FOR_CODE_COV = 1; diff --git a/src/backend/storage/types.ts b/src/backend/storage/types.d.ts similarity index 89% rename from src/backend/storage/types.ts rename to src/backend/storage/types.d.ts index a9d564096..5af8f18a5 100644 --- a/src/backend/storage/types.ts +++ b/src/backend/storage/types.d.ts @@ -5,5 +5,3 @@ export interface IStorageIntegrationsImplemention { integrationConfigurationSchema: IAppliedSchemaFormConfig; store: (integrationConfig: T, file: File) => Promise; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/components/SchemaForm/types.ts b/src/frontend/components/SchemaForm/types.d.ts similarity index 96% rename from src/frontend/components/SchemaForm/types.ts rename to src/frontend/components/SchemaForm/types.d.ts index 54956f824..1d0e9f2e8 100644 --- a/src/frontend/components/SchemaForm/types.ts +++ b/src/frontend/components/SchemaForm/types.d.ts @@ -31,5 +31,3 @@ export interface IRenderFormInputProps { from?: string; rightActions?: IFormInputRightAction[]; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/design-system/components/Button/types.ts b/src/frontend/design-system/components/Button/types.d.ts similarity index 95% rename from src/frontend/design-system/components/Button/types.ts rename to src/frontend/design-system/components/Button/types.d.ts index 48fbceaaa..aab2c0052 100644 --- a/src/frontend/design-system/components/Button/types.ts +++ b/src/frontend/design-system/components/Button/types.d.ts @@ -20,5 +20,3 @@ export interface IGroupActionButton extends IActionButton { id: string; order?: number; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/design-system/components/EmptyWrapper/types.ts b/src/frontend/design-system/components/EmptyWrapper/types.d.ts similarity index 85% rename from src/frontend/design-system/components/EmptyWrapper/types.ts rename to src/frontend/design-system/components/EmptyWrapper/types.d.ts index 4b672e7d3..eea63c8d4 100644 --- a/src/frontend/design-system/components/EmptyWrapper/types.ts +++ b/src/frontend/design-system/components/EmptyWrapper/types.d.ts @@ -4,5 +4,3 @@ export interface IEmptyWrapperProps { text: MessageDescriptor; createNew?: { action: string | (() => void); label: MessageDescriptor }; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/design-system/components/Form/types.ts b/src/frontend/design-system/components/Form/types.d.ts similarity index 94% rename from src/frontend/design-system/components/Form/types.ts rename to src/frontend/design-system/components/Form/types.d.ts index 621415db4..533f07c68 100644 --- a/src/frontend/design-system/components/Form/types.ts +++ b/src/frontend/design-system/components/Form/types.d.ts @@ -16,5 +16,3 @@ export interface ISharedFormInput extends ILabelAndErrorProps { placeholder?: MessageDescriptor; disabled?: boolean; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/design-system/components/IntermediateCheckBox/IntermediateCheckBox.spec.tsx b/src/frontend/design-system/components/IntermediateCheckBox/IntermediateCheckBox.spec.tsx new file mode 100644 index 000000000..838443481 --- /dev/null +++ b/src/frontend/design-system/components/IntermediateCheckBox/IntermediateCheckBox.spec.tsx @@ -0,0 +1,42 @@ +import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { IntermediateCheckBox } from "."; + +describe("IntermediateCheckBox", () => { + it("should render checked state correctly", () => { + render( + + ); + + expect(screen.getByRole("checkbox", { name: "Test" })).toBeChecked(); + }); + + it("should render un-checked state correctly", () => { + render( + + ); + + expect(screen.getByRole("checkbox", { name: "Test" })).not.toBeChecked(); + }); + + it("should render partial state correctly", () => { + render( + + ); + + expect( + screen.getByRole("checkbox", { name: "Test" }) + ).toBePartiallyChecked(); + }); + + it("should call onClick with the correct state when pressed", async () => { + const onClick = jest.fn(); + render( + + ); + + await userEvent.click(screen.getByRole("checkbox", { name: "Test" })); + + expect(onClick).toHaveBeenCalledWith("partial"); + }); +}); diff --git a/src/frontend/design-system/components/IntermediateCheckBox/index.tsx b/src/frontend/design-system/components/IntermediateCheckBox/index.tsx index dd11a3508..1559843fb 100644 --- a/src/frontend/design-system/components/IntermediateCheckBox/index.tsx +++ b/src/frontend/design-system/components/IntermediateCheckBox/index.tsx @@ -48,10 +48,6 @@ export function IntermediateCheckBox({ disabled, label, }: IProps) { - const handleClick = () => { - onClick(state); - }; - return ( { e.stopPropagation(); - handleClick(); - }} - onKeyDown={(e) => { - e.stopPropagation(); - - if (e.key === "Enter" || e.key === " ") { - handleClick(); - } + onClick(state); }} > diff --git a/src/frontend/design-system/components/Table/filters/types.ts b/src/frontend/design-system/components/Table/filters/types.d.ts similarity index 82% rename from src/frontend/design-system/components/Table/filters/types.ts rename to src/frontend/design-system/components/Table/filters/types.d.ts index eb35966ca..f99a94f4e 100644 --- a/src/frontend/design-system/components/Table/filters/types.ts +++ b/src/frontend/design-system/components/Table/filters/types.d.ts @@ -5,5 +5,3 @@ export interface IFilterProps { }; bag: K; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/design-system/theme/types.ts b/src/frontend/design-system/theme/types.d.ts similarity index 91% rename from src/frontend/design-system/theme/types.ts rename to src/frontend/design-system/theme/types.d.ts index 5348bfd9d..377bf8930 100644 --- a/src/frontend/design-system/theme/types.ts +++ b/src/frontend/design-system/theme/types.d.ts @@ -14,5 +14,3 @@ export type IRootColors = | keyof IColorMode | "primary-shade-color" | "primary-color"; - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/lib/crud-config/types.ts b/src/frontend/lib/crud-config/types.d.ts similarity index 82% rename from src/frontend/lib/crud-config/types.ts rename to src/frontend/lib/crud-config/types.d.ts index 72d06ef8d..ec876b9b4 100644 --- a/src/frontend/lib/crud-config/types.ts +++ b/src/frontend/lib/crud-config/types.d.ts @@ -4,5 +4,3 @@ export interface IDomainDiction { singular: MessageDescriptor; plural: MessageDescriptor; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/lib/data/useMutate/types.ts b/src/frontend/lib/data/useMutate/types.d.ts similarity index 94% rename from src/frontend/lib/data/useMutate/types.ts rename to src/frontend/lib/data/useMutate/types.d.ts index 783f7b408..508bdab26 100644 --- a/src/frontend/lib/data/useMutate/types.ts +++ b/src/frontend/lib/data/useMutate/types.d.ts @@ -16,5 +16,3 @@ export interface IApiMutateOptions { smartSuccessMessage?: (formData: R) => ToastMessageInput; onSuccessActionWithFormData?: (formData: R) => void; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/lib/form/types.ts b/src/frontend/lib/form/types.d.ts similarity index 77% rename from src/frontend/lib/form/types.ts rename to src/frontend/lib/form/types.d.ts index 0194ec394..7719984fa 100644 --- a/src/frontend/lib/form/types.ts +++ b/src/frontend/lib/form/types.d.ts @@ -2,5 +2,3 @@ export interface IFormProps { onSubmit: (arg0: T) => Promise; initialValues?: Partial; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/views/Dashboard/Widget/_components/WidgetHeader/types.ts b/src/frontend/views/Dashboard/Widget/_components/WidgetHeader/types.d.ts similarity index 72% rename from src/frontend/views/Dashboard/Widget/_components/WidgetHeader/types.ts rename to src/frontend/views/Dashboard/Widget/_components/WidgetHeader/types.d.ts index 3451acffc..5b82d6582 100644 --- a/src/frontend/views/Dashboard/Widget/_components/WidgetHeader/types.ts +++ b/src/frontend/views/Dashboard/Widget/_components/WidgetHeader/types.d.ts @@ -2,5 +2,3 @@ export interface IWidgetSettingProps { setId: () => void; delete: () => void; } - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/views/Dashboard/Widget/_manage/types.ts b/src/frontend/views/Dashboard/Widget/_manage/types.d.ts similarity index 79% rename from src/frontend/views/Dashboard/Widget/_manage/types.ts rename to src/frontend/views/Dashboard/Widget/_manage/types.d.ts index 88e9146af..aaf848bb7 100644 --- a/src/frontend/views/Dashboard/Widget/_manage/types.ts +++ b/src/frontend/views/Dashboard/Widget/_manage/types.d.ts @@ -1,5 +1,3 @@ import { PortalWidgetFormField } from "./portal"; export type WidgetFormField = PortalWidgetFormField | "color" | "icon"; - -export const FOR_CODE_COV = 1; diff --git a/src/frontend/views/Dashboard/Widget/types.ts b/src/frontend/views/Dashboard/Widget/types.d.ts similarity index 93% rename from src/frontend/views/Dashboard/Widget/types.ts rename to src/frontend/views/Dashboard/Widget/types.d.ts index 64597be70..f960ad9de 100644 --- a/src/frontend/views/Dashboard/Widget/types.ts +++ b/src/frontend/views/Dashboard/Widget/types.d.ts @@ -13,5 +13,3 @@ export interface IWidgetConfigBag { LoadingComponent: (prop: { height: string }) => ReactElement; isDataEmpty: (data: unknown) => boolean; } - -export const FOR_CODE_COV = 1; diff --git a/src/shared/configurations/base-types.ts b/src/shared/configurations/base-types.d.ts similarity index 96% rename from src/shared/configurations/base-types.ts rename to src/shared/configurations/base-types.d.ts index 16b32def5..83b11604a 100644 --- a/src/shared/configurations/base-types.ts +++ b/src/shared/configurations/base-types.d.ts @@ -31,5 +31,3 @@ export type BaseAppConfigurationKeys = | "file_upload_settings" | "metadata_columns" | "entity_relations_order"; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/constants/portal/menu/index.ts b/src/shared/constants/portal/menu/index.d.ts similarity index 57% rename from src/shared/constants/portal/menu/index.ts rename to src/shared/constants/portal/menu/index.d.ts index 8382e751a..6cd1bef44 100644 --- a/src/shared/constants/portal/menu/index.ts +++ b/src/shared/constants/portal/menu/index.d.ts @@ -1,3 +1 @@ export { PortalSystemLinks } from "./main"; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/constants/portal/menu/main.ts b/src/shared/constants/portal/menu/main.d.ts similarity index 50% rename from src/shared/constants/portal/menu/main.ts rename to src/shared/constants/portal/menu/main.d.ts index 5b9dbe2e1..a588d9348 100644 --- a/src/shared/constants/portal/menu/main.ts +++ b/src/shared/constants/portal/menu/main.d.ts @@ -1,3 +1 @@ export enum PortalSystemLinks {} - -export const FOR_CODE_COV = 1; diff --git a/src/shared/form-schemas/roles/permissions/base.ts b/src/shared/form-schemas/roles/permissions/base.d.ts similarity index 66% rename from src/shared/form-schemas/roles/permissions/base.ts rename to src/shared/form-schemas/roles/permissions/base.d.ts index 900fabebe..32bab0499 100644 --- a/src/shared/form-schemas/roles/permissions/base.ts +++ b/src/shared/form-schemas/roles/permissions/base.d.ts @@ -1,5 +1,3 @@ export type IBasePermissionForm = { permissions: string[]; }; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/form-schemas/types.ts b/src/shared/form-schemas/types.d.ts similarity index 97% rename from src/shared/form-schemas/types.ts rename to src/shared/form-schemas/types.d.ts index 7da579c91..dae403e22 100644 --- a/src/shared/form-schemas/types.ts +++ b/src/shared/form-schemas/types.d.ts @@ -37,5 +37,3 @@ export type ISchemaFormConfig = { }; export type IAppliedSchemaFormConfig = Record>; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/form-schemas/users/index.ts b/src/shared/form-schemas/users/index.d.ts similarity index 84% rename from src/shared/form-schemas/users/index.ts rename to src/shared/form-schemas/users/index.d.ts index 84441dff6..6994572f3 100644 --- a/src/shared/form-schemas/users/index.ts +++ b/src/shared/form-schemas/users/index.d.ts @@ -9,5 +9,3 @@ export type IUpdateUserForm = { name: string; role: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/auth/index.ts b/src/shared/types/auth/index.d.ts similarity index 72% rename from src/shared/types/auth/index.ts rename to src/shared/types/auth/index.d.ts index c5ad84234..a06529d0f 100644 --- a/src/shared/types/auth/index.ts +++ b/src/shared/types/auth/index.d.ts @@ -2,5 +2,3 @@ export interface ISetupCheck { hasDbCredentials?: boolean; hasUsers?: boolean; } - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/auth/portal/index.ts b/src/shared/types/auth/portal/index.d.ts similarity index 67% rename from src/shared/types/auth/portal/index.ts rename to src/shared/types/auth/portal/index.d.ts index 901e625bf..0df5f2803 100644 --- a/src/shared/types/auth/portal/index.ts +++ b/src/shared/types/auth/portal/index.d.ts @@ -1,3 +1 @@ export type { ISuccessfullAuthenticationResponse } from "./main"; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/auth/portal/main.ts b/src/shared/types/auth/portal/main.d.ts similarity index 69% rename from src/shared/types/auth/portal/main.ts rename to src/shared/types/auth/portal/main.d.ts index 8250c73e3..05fd1908a 100644 --- a/src/shared/types/auth/portal/main.ts +++ b/src/shared/types/auth/portal/main.d.ts @@ -1,5 +1,3 @@ export interface ISuccessfullAuthenticationResponse { token: string; } - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/dashboard/base.ts b/src/shared/types/dashboard/base.d.ts similarity index 88% rename from src/shared/types/dashboard/base.ts rename to src/shared/types/dashboard/base.d.ts index 0f020f9fd..b85d54dc9 100644 --- a/src/shared/types/dashboard/base.ts +++ b/src/shared/types/dashboard/base.d.ts @@ -9,5 +9,3 @@ export interface ISharedWidgetConfig { span?: GridSpanSizes; height?: GridHeightSizes; } - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/data.ts b/src/shared/types/data.ts index 826c9be10..5130e0140 100644 --- a/src/shared/types/data.ts +++ b/src/shared/types/data.ts @@ -98,6 +98,4 @@ export type ITableView = { >; }; -export const FOR_CODE_COV = 1; - export type DataCrudKeys = "create" | "update" | "table" | "details"; diff --git a/src/shared/types/db.ts b/src/shared/types/db.d.ts similarity index 95% rename from src/shared/types/db.ts rename to src/shared/types/db.d.ts index 96f2adfa5..a1238d5e8 100644 --- a/src/shared/types/db.ts +++ b/src/shared/types/db.d.ts @@ -32,5 +32,3 @@ export interface IDBSchema { uniqueFields: string[][]; relations: IDBSchemaRelation[]; } - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/options.ts b/src/shared/types/options.d.ts similarity index 92% rename from src/shared/types/options.ts rename to src/shared/types/options.d.ts index 4aaee0af4..7d11c0c8d 100644 --- a/src/shared/types/options.ts +++ b/src/shared/types/options.d.ts @@ -10,8 +10,6 @@ export type IKeyValue = { value: string; }; -export const FOR_CODE_COV = 1; - export interface ISystemStatusForDisplay { label: MessageDescriptor; value: string | boolean; diff --git a/src/shared/types/portal/widgets/index.ts b/src/shared/types/portal/widgets/index.d.ts similarity index 61% rename from src/shared/types/portal/widgets/index.ts rename to src/shared/types/portal/widgets/index.d.ts index 79aae5699..21dd38721 100644 --- a/src/shared/types/portal/widgets/index.ts +++ b/src/shared/types/portal/widgets/index.d.ts @@ -1,3 +1 @@ export type { IPortalWidgetConfig } from "./main"; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/portal/widgets/main/index.ts b/src/shared/types/portal/widgets/main/index.d.ts similarity index 86% rename from src/shared/types/portal/widgets/main/index.ts rename to src/shared/types/portal/widgets/main/index.d.ts index 65b3d728e..071a67e29 100644 --- a/src/shared/types/portal/widgets/main/index.ts +++ b/src/shared/types/portal/widgets/main/index.d.ts @@ -5,5 +5,3 @@ export interface INeverWidgetConfig extends ISharedWidgetConfig { } export type IPortalWidgetConfig = INeverWidgetConfig; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/roles.ts b/src/shared/types/roles.d.ts similarity index 66% rename from src/shared/types/roles.ts rename to src/shared/types/roles.d.ts index 71431256f..6d3968249 100644 --- a/src/shared/types/roles.ts +++ b/src/shared/types/roles.d.ts @@ -2,5 +2,3 @@ export type IRolesList = { label: string; value: string; }; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/types/ui.ts b/src/shared/types/ui.d.ts similarity index 94% rename from src/shared/types/ui.ts rename to src/shared/types/ui.d.ts index 837dc1120..9294d6f20 100644 --- a/src/shared/types/ui.ts +++ b/src/shared/types/ui.d.ts @@ -11,8 +11,6 @@ export type EntityTypesForSelection = | "selection-enum" | "boolean"; -export const FOR_CODE_COV = 1; - export type ColorSchemes = "light" | "dark"; export type GridSpanSizes = diff --git a/src/shared/user-preferences/base-types.ts b/src/shared/user-preferences/base-types.d.ts similarity index 59% rename from src/shared/user-preferences/base-types.ts rename to src/shared/user-preferences/base-types.d.ts index f5c05e8fc..658d2c9d4 100644 --- a/src/shared/user-preferences/base-types.ts +++ b/src/shared/user-preferences/base-types.d.ts @@ -1,3 +1 @@ export type BaseUserPreferencesKeys = "theme"; - -export const FOR_CODE_COV = 1; diff --git a/src/shared/user-preferences/types.ts b/src/shared/user-preferences/types.ts index 367f0de06..0baaf4f52 100644 --- a/src/shared/user-preferences/types.ts +++ b/src/shared/user-preferences/types.ts @@ -2,5 +2,3 @@ export interface IUserPreferencesBag { defaultValue: unknown; label: string; } - -export const FOR_CODE_COV = 1; diff --git a/src/shared/validations/types.ts b/src/shared/validations/types.d.ts similarity index 97% rename from src/shared/validations/types.ts rename to src/shared/validations/types.d.ts index 38e087b54..04da64768 100644 --- a/src/shared/validations/types.ts +++ b/src/shared/validations/types.d.ts @@ -56,5 +56,3 @@ export type FormFieldTypes = | "image" | "datetime-local" | "color"; - -export const FOR_CODE_COV = 1;