From 2181462efe2bd78d3b1baf6b9b9c03b74e26db4b Mon Sep 17 00:00:00 2001 From: Polina Date: Thu, 16 Oct 2025 19:49:54 +0200 Subject: [PATCH 1/6] fix: alias in spec.ts files --- .../interceptor-templates/[id]/page.tsx | 2 +- .../ImportConfig/ImportConfig.spec.tsx | 2 +- .../tests/BasePublicationHeader.spec.tsx | 2 +- .../src/components/Rules/utils.spec.tsx | 2 +- .../validation/tests/version-error.spec.ts | 4 +-- apps/ai-dial-admin/tsconfig.app.json | 31 +++++++++++++++++++ apps/ai-dial-admin/tsconfig.json | 28 ++++++++--------- 7 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 apps/ai-dial-admin/tsconfig.app.json diff --git a/apps/ai-dial-admin/src/app/[lang]/interceptor-templates/[id]/page.tsx b/apps/ai-dial-admin/src/app/[lang]/interceptor-templates/[id]/page.tsx index c3229f852..b78d052d8 100644 --- a/apps/ai-dial-admin/src/app/[lang]/interceptor-templates/[id]/page.tsx +++ b/apps/ai-dial-admin/src/app/[lang]/interceptor-templates/[id]/page.tsx @@ -10,7 +10,7 @@ import { SaveValidationContextProvider } from '@/src/context/SaveValidationConte import { DEFAULT_ETAG } from '@/src/constants/api-headers'; import { InterceptorTemplate } from '@/src/models/interceptor-template'; import { DialInterceptor } from '@/src/models/dial/interceptor'; -import { getInterceptorsList } from '../../interceptors/actions'; +import { getInterceptorsList } from '@/src/app/[lang]/interceptors/actions'; import { filterNames } from '@/src/utils/entities/filter-names'; import { ApplicationRoute } from '@/src/types/routes'; import { getIsEnableAuthToggle } from '@/src/utils/env/get-auth-toggle'; diff --git a/apps/ai-dial-admin/src/components/ImportConfig/ImportConfig.spec.tsx b/apps/ai-dial-admin/src/components/ImportConfig/ImportConfig.spec.tsx index 67cb741eb..cec6dca46 100644 --- a/apps/ai-dial-admin/src/components/ImportConfig/ImportConfig.spec.tsx +++ b/apps/ai-dial-admin/src/components/ImportConfig/ImportConfig.spec.tsx @@ -1,6 +1,6 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { describe, test, vi } from 'vitest'; -import { ButtonsI18nKey } from '../../constants/i18n'; +import { ButtonsI18nKey } from '@/src/constants/i18n'; import ImportConfig from './ImportConfig'; vi.mock('@/src/context/NotificationContext', () => ({ diff --git a/apps/ai-dial-admin/src/components/PublicationView/BasePublicationProperties/tests/BasePublicationHeader.spec.tsx b/apps/ai-dial-admin/src/components/PublicationView/BasePublicationProperties/tests/BasePublicationHeader.spec.tsx index c198cd476..e0026b91b 100644 --- a/apps/ai-dial-admin/src/components/PublicationView/BasePublicationProperties/tests/BasePublicationHeader.spec.tsx +++ b/apps/ai-dial-admin/src/components/PublicationView/BasePublicationProperties/tests/BasePublicationHeader.spec.tsx @@ -3,7 +3,7 @@ import { ApplicationRoute } from '@/src/types/routes'; import { fireEvent, render, screen } from '@testing-library/react'; import { describe, expect, test, vi } from 'vitest'; import BasePublicationHeader from '../BasePublicationHeader'; -import { ButtonsI18nKey } from '../../../../constants/i18n'; +import { ButtonsI18nKey } from '@/src/constants/i18n'; describe('BasePublicationHeader', () => { test('Should render approve and decline buttons', () => { render( diff --git a/apps/ai-dial-admin/src/components/Rules/utils.spec.tsx b/apps/ai-dial-admin/src/components/Rules/utils.spec.tsx index 04f59e9fe..159afe861 100644 --- a/apps/ai-dial-admin/src/components/Rules/utils.spec.tsx +++ b/apps/ai-dial-admin/src/components/Rules/utils.spec.tsx @@ -3,7 +3,7 @@ import { render } from '@testing-library/react'; import { DialRule, RuleDiffStatus, RuleFunction } from '@/src/models/dial/rule'; import { describe, expect, test } from 'vitest'; import { generateRuleDiff, getAttributeItems, getOperationIcon, getOperationItems, sortRules } from './utils'; -import { FoldersI18nKey } from '../../constants/i18n'; +import { FoldersI18nKey } from '@/src/constants/i18n'; describe('Rules :: getOperationIcon', () => { test('returns IconEqual component when operation is EQUAL', () => { diff --git a/apps/ai-dial-admin/src/utils/validation/tests/version-error.spec.ts b/apps/ai-dial-admin/src/utils/validation/tests/version-error.spec.ts index 6119f92d6..abe07f344 100644 --- a/apps/ai-dial-admin/src/utils/validation/tests/version-error.spec.ts +++ b/apps/ai-dial-admin/src/utils/validation/tests/version-error.spec.ts @@ -1,8 +1,8 @@ import { ErrorI18nKey } from '@/src/constants/i18n'; import { describe, expect, test } from 'vitest'; import { getPromptVersionError, getVersionControlError } from '../version-error'; -import { ErrorType } from '../../../types/error-type'; -import { MAX_NAME_SYMBOLS } from '../../../constants/validation'; +import { ErrorType } from '@/src/types/error-type'; +import { MAX_NAME_SYMBOLS } from '@/src/constants/validation'; describe('getPromptVersionError', () => { const t = (key: string) => key; diff --git a/apps/ai-dial-admin/tsconfig.app.json b/apps/ai-dial-admin/tsconfig.app.json new file mode 100644 index 000000000..d7b57e72b --- /dev/null +++ b/apps/ai-dial-admin/tsconfig.app.json @@ -0,0 +1,31 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "jsx": "preserve", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "resolveJsonModule": true, + "isolatedModules": true, + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "types": ["node", "@testing-library/jest-dom"] + }, + "include": [ + "**/*.ts", + "**/*.tsx", + "**/*.js", + "**/*.jsx", + "../../apps/ai-dial-admin/.next/types/**/*.ts", + "../../dist/apps/ai-dial-admin/.next/types/**/*.ts", + "next-env.d.ts", + ".next/types/**/*.ts" + ], + "exclude": ["node_modules", "**.config.ts", "**/*.spec.ts", "**/*.test.ts"] +} diff --git a/apps/ai-dial-admin/tsconfig.json b/apps/ai-dial-admin/tsconfig.json index 22841a0b0..42b37104f 100644 --- a/apps/ai-dial-admin/tsconfig.json +++ b/apps/ai-dial-admin/tsconfig.json @@ -1,31 +1,31 @@ { - "extends": "../../tsconfig.base.json", "compilerOptions": { "jsx": "preserve", - "allowJs": true, + "allowJs": false, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, + "strict": true, "noEmit": true, + "incremental": true, "resolveJsonModule": true, "isolatedModules": true, - "incremental": true, "plugins": [ { "name": "next" } - ], - "types": ["node", "@testing-library/jest-dom"] + ] }, + "files": [], "include": [ - "**/*.ts", - "**/*.tsx", - "**/*.js", - "**/*.jsx", - "../../apps/ai-dial-admin/.next/types/**/*.ts", - "../../dist/apps/ai-dial-admin/.next/types/**/*.ts", - "next-env.d.ts", ".next/types/**/*.ts" ], - "exclude": ["node_modules", "**.config.ts", "**/*.spec.ts", "**/*.test.ts"] + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../tsconfig.base.json" } From c6b4d606a80b025a67c44f3f966d97e719437055 Mon Sep 17 00:00:00 2001 From: Polina Date: Thu, 16 Oct 2025 20:11:48 +0200 Subject: [PATCH 2/6] fix lint --- apps/ai-dial-admin/tsconfig.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/ai-dial-admin/tsconfig.json b/apps/ai-dial-admin/tsconfig.json index 42b37104f..d8489a33d 100644 --- a/apps/ai-dial-admin/tsconfig.json +++ b/apps/ai-dial-admin/tsconfig.json @@ -16,9 +16,7 @@ ] }, "files": [], - "include": [ - ".next/types/**/*.ts" - ], + "include": [".next/types/**/*.ts"], "references": [ { "path": "./tsconfig.app.json" From 19c9ec03030c8a078c9ac27f6ab7d6b918c568c1 Mon Sep 17 00:00:00 2001 From: Polina Date: Fri, 31 Oct 2025 15:05:11 +0100 Subject: [PATCH 3/6] fix: alias in spec.ts files --- .../tests/AddEntitiesView.spec.tsx | 14 +++++----- .../SingleValueChart.spec.tsx | 8 +++--- .../AttachmentInput/AttachmentInput.spec.tsx | 8 +++--- .../Common/FolderList/FolderList.spec.tsx | 6 ++-- .../Common/LabelledText/LabelledText.spec.tsx | 10 +++---- .../Common/Multiselect/Multiselect.spec.tsx | 4 +-- .../ReadonlyField/ReadonlyField.spec.tsx | 6 ++-- .../src/components/Content/Content.spec.tsx | 6 ++-- .../EntityListView/tests/utils.spec.ts | 28 +++++++++---------- .../Preview/tests/PreviewModal.spec.tsx | 16 +++++------ .../ExportConfig/tests/ExportConfig.spec.tsx | 7 ++--- .../src/components/Header/Header.spec.tsx | 8 +++--- .../Header/User/ProfileButton.spec.tsx | 8 +++--- .../InterceptorTemplates/View/View.spec.tsx | 7 ++--- .../src/components/Menu/Menu.spec.tsx | 6 ++-- .../tests/ModelProperties.spec.tsx | 7 ++--- .../tests/DynamicNotification.spec.tsx | 12 ++++---- .../Notification/tests/Notification.spec.tsx | 14 +++++----- .../tests/NotificationPortal.spec.tsx | 10 +++---- .../Filters/tests/CreateFilter.spec.tsx | 12 ++++---- .../Filters/tests/Filter.spec.tsx | 12 ++++---- .../components/Toolsets/Tools/utils.spec.ts | 16 +++++------ .../Endpoint/Endpoint.spec.tsx | 16 +++++------ .../ExtraData/ExtraDataField.spec.tsx | 10 +++---- .../src/server/tests/deployments-api.spec.ts | 8 +++--- .../entities/tests/create-enetity.spec.ts | 8 +++--- .../utils/entities/tests/filter-names.spec.ts | 22 +++++++-------- .../entities/tests/rollback-entity.spec.ts | 10 +++---- .../entities/tests/update-entity.spec.ts | 6 ++-- 29 files changed, 151 insertions(+), 154 deletions(-) diff --git a/apps/ai-dial-admin/src/components/AddEntitiesTab/tests/AddEntitiesView.spec.tsx b/apps/ai-dial-admin/src/components/AddEntitiesTab/tests/AddEntitiesView.spec.tsx index cab5136b9..49953315b 100644 --- a/apps/ai-dial-admin/src/components/AddEntitiesTab/tests/AddEntitiesView.spec.tsx +++ b/apps/ai-dial-admin/src/components/AddEntitiesTab/tests/AddEntitiesView.spec.tsx @@ -1,7 +1,7 @@ -import { render, screen, fireEvent } from '@testing-library/react'; -import { describe, it, expect, vi } from 'vitest'; -import AddEntitiesView from '../AddEntitiesView'; import { ButtonsI18nKey, EntitiesI18nKey } from '@/src/constants/i18n'; +import { fireEvent, render, screen } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; +import AddEntitiesView from '../AddEntitiesView'; // Mock createPortal to render modal content inline for test simplicity vi.mock('react-dom', () => ({ @@ -10,7 +10,7 @@ vi.mock('react-dom', () => ({ })); describe('AddEntitiesView', () => { - it('renders the view title and entity count', () => { + test('renders the view title and entity count', () => { const customColumns = [{ field: 'custom', headerName: 'Custom' }]; render( { expect(screen.getByText(EntitiesI18nKey.NoEntities)).toBeInTheDocument(); }); - it('calls onAdd when AddEntitiesGrid onApply is triggered', () => { + test('calls onAdd when AddEntitiesGrid onApply is triggered', () => { const onAdd = vi.fn(); const models = [{ id: '1', name: 'Model1' }]; render(); @@ -37,14 +37,14 @@ describe('AddEntitiesView', () => { fireEvent.click(modalButtons[1]); }); - it('calls onRemove when remove operation is triggered', () => { + test('calls onRemove when remove operation is triggered', () => { const onRemove = vi.fn(); const models = [{ id: '1', name: 'Model1' }]; render(); expect(typeof onRemove).toBe('function'); }); - it('renders with getRelevantDataForEntity', () => { + test('renders with getRelevantDataForEntity', () => { const getRelevantDataForEntity = vi.fn(() => []); render( { - it('renders the title as text', () => { + test('renders the title as text', () => { render(); expect(screen.getByText('Test Title')).toBeInTheDocument(); }); - it('renders the unit if provided', async () => { + test('renders the unit if provided', async () => { render(); expect(await screen.findByText('ms')).toBeInTheDocument(); }); - it('renders NoDataContent if data is null', async () => { + test('renders NoDataContent if data is null', async () => { mockGetData.mockResolvedValueOnce({ success: false } as any); render(); expect(await screen.findByText(BasicI18nKey.NoData)).toBeInTheDocument(); diff --git a/apps/ai-dial-admin/src/components/Common/AttachmentInput/AttachmentInput.spec.tsx b/apps/ai-dial-admin/src/components/Common/AttachmentInput/AttachmentInput.spec.tsx index 2891f1283..436903239 100644 --- a/apps/ai-dial-admin/src/components/Common/AttachmentInput/AttachmentInput.spec.tsx +++ b/apps/ai-dial-admin/src/components/Common/AttachmentInput/AttachmentInput.spec.tsx @@ -1,6 +1,6 @@ import { render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest'; +import { afterEach, beforeAll, describe, expect, it, test, vi } from 'vitest'; import AttachmentInput from './AttachmentInput'; import { AttachmentsI18nKey } from '@/src/constants/i18n'; @@ -26,14 +26,14 @@ const options = [ ]; describe('Common components - AttachmentInput', () => { - it('renders tags from initialValues', () => { + test('renders tags from initialValues', () => { render(); expect(screen.getByText('PDF')).toBeInTheDocument(); expect(screen.getByRole('button', { name: AttachmentsI18nKey.UseAll })).toBeInTheDocument(); }); - it('filters suggestions while typing and adds one on click', async () => { + test('filters suggestions while typing and adds one on click', async () => { const onChange = vi.fn(); render(); @@ -50,7 +50,7 @@ describe('Common components - AttachmentInput', () => { expect(screen.queryByRole('list ')).toBeNull(); }); - it('selects all items with the “Select all” button and resets on remove', async () => { + test('selects all items with the “Select all” button and resets on remove', async () => { const onChange = vi.fn(); render(); diff --git a/apps/ai-dial-admin/src/components/Common/FolderList/FolderList.spec.tsx b/apps/ai-dial-admin/src/components/Common/FolderList/FolderList.spec.tsx index 83799a8df..36fb3a3e1 100644 --- a/apps/ai-dial-admin/src/components/Common/FolderList/FolderList.spec.tsx +++ b/apps/ai-dial-admin/src/components/Common/FolderList/FolderList.spec.tsx @@ -1,7 +1,7 @@ +import { EntitiesI18nKey } from '@/src/constants/i18n'; import { render, screen } from '@testing-library/react'; -import { describe, it, expect } from 'vitest'; +import { describe, expect, test } from 'vitest'; import FolderList from './FolderList'; -import { EntitiesI18nKey } from '@/src/constants/i18n'; const fakeContext = () => ({ files: [], @@ -16,7 +16,7 @@ const fakeContext = () => ({ }); describe('FolderList', () => { - it('renders no data message when files are empty', () => { + test('renders no data message when files are empty', () => { render(); expect(screen.getByText(EntitiesI18nKey.NoFolders)).toBeInTheDocument(); }); diff --git a/apps/ai-dial-admin/src/components/Common/LabelledText/LabelledText.spec.tsx b/apps/ai-dial-admin/src/components/Common/LabelledText/LabelledText.spec.tsx index 0c79d6d87..2263172f8 100644 --- a/apps/ai-dial-admin/src/components/Common/LabelledText/LabelledText.spec.tsx +++ b/apps/ai-dial-admin/src/components/Common/LabelledText/LabelledText.spec.tsx @@ -1,15 +1,15 @@ import { render, screen } from '@testing-library/react'; -import { describe, it, expect } from 'vitest'; +import { describe, expect, test } from 'vitest'; import LabelledText from './LabelledText'; describe('LabelledText', () => { - it('renders label and text', () => { + test('renders label and text', () => { render(); expect(screen.getByText('Test Label')).toBeInTheDocument(); expect(screen.getByText('Test Text')).toBeInTheDocument(); }); - it('renders children instead of text if provided', () => { + test('renders children instead of text if provided', () => { render( Child Content @@ -19,12 +19,12 @@ describe('LabelledText', () => { expect(screen.getByText('Child Label')).toBeInTheDocument(); }); - it('renders copy button if copyButton is true', () => { + test('renders copy button if copyButton is true', () => { render(); expect(screen.getByLabelText('copy')).toBeInTheDocument(); }); - it('renders without text', () => { + test('renders without text', () => { render(); expect(screen.getByText('No Text')).toBeInTheDocument(); }); diff --git a/apps/ai-dial-admin/src/components/Common/Multiselect/Multiselect.spec.tsx b/apps/ai-dial-admin/src/components/Common/Multiselect/Multiselect.spec.tsx index fb66346de..133ee4adb 100644 --- a/apps/ai-dial-admin/src/components/Common/Multiselect/Multiselect.spec.tsx +++ b/apps/ai-dial-admin/src/components/Common/Multiselect/Multiselect.spec.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, test } from 'vitest'; import Multiselect from './Multiselect'; describe('Multiselect', () => { - it('renders field title and error text', () => { + test('renders field title and error text', () => { render(); expect(screen.getByText('Title')).toBeInTheDocument(); expect(screen.getByText('Error!')).toBeInTheDocument(); diff --git a/apps/ai-dial-admin/src/components/Common/ReadonlyField/ReadonlyField.spec.tsx b/apps/ai-dial-admin/src/components/Common/ReadonlyField/ReadonlyField.spec.tsx index 0be853143..3fe2bae44 100644 --- a/apps/ai-dial-admin/src/components/Common/ReadonlyField/ReadonlyField.spec.tsx +++ b/apps/ai-dial-admin/src/components/Common/ReadonlyField/ReadonlyField.spec.tsx @@ -1,15 +1,15 @@ import { render, screen } from '@testing-library/react'; -import { describe, it, expect } from 'vitest'; +import { describe, expect, test } from 'vitest'; import ReadonlyField from './ReadonlyField'; describe('ReadonlyField', () => { - it('renders the title and value', () => { + test('renders the title and value', () => { render(); expect(screen.getByDisplayValue('Test Value')).toBeInTheDocument(); expect(screen.getByText('Test Title')).toBeInTheDocument(); }); - it('renders with empty value', () => { + test('renders with empty value', () => { render(); expect(screen.getByDisplayValue('')).toBeInTheDocument(); expect(screen.getByText('Empty Value')).toBeInTheDocument(); diff --git a/apps/ai-dial-admin/src/components/Content/Content.spec.tsx b/apps/ai-dial-admin/src/components/Content/Content.spec.tsx index 8de13b74f..a1724e9c4 100644 --- a/apps/ai-dial-admin/src/components/Content/Content.spec.tsx +++ b/apps/ai-dial-admin/src/components/Content/Content.spec.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; -import { describe, it, expect } from 'vitest'; +import { describe, expect, test } from 'vitest'; import Content from './Content'; describe('Content', () => { - it('renders children', () => { + test('renders children', () => { render(
Test Content
@@ -12,7 +12,7 @@ describe('Content', () => { expect(screen.getByText('Test Content')).toBeInTheDocument(); }); - it('renders with beVersion', () => { + test('renders with beVersion', () => { render( Versioned diff --git a/apps/ai-dial-admin/src/components/EntityListView/tests/utils.spec.ts b/apps/ai-dial-admin/src/components/EntityListView/tests/utils.spec.ts index a98da5f32..f34c402a1 100644 --- a/apps/ai-dial-admin/src/components/EntityListView/tests/utils.spec.ts +++ b/apps/ai-dial-admin/src/components/EntityListView/tests/utils.spec.ts @@ -2,31 +2,31 @@ import { exportFiles } from '@/src/app/[lang]/files/actions'; import { exportPrompts } from '@/src/app/[lang]/prompts/actions'; import { MenuI18nKey } from '@/src/constants/i18n'; import { ApplicationRoute } from '@/src/types/routes'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, test } from 'vitest'; import { getExportFunction, getJsonFileName, getNotificationType } from '../utils'; describe('getNotificationType', () => { - it('should return MenuI18nKey.Prompts when route is Prompts', () => { + test('should return MenuI18nKey.Prompts when route is Prompts', () => { const result = getNotificationType(ApplicationRoute.Prompts); expect(result).toBe(MenuI18nKey.Prompts); }); - it('should return MenuI18nKey.Files when route is Files', () => { + test('should return MenuI18nKey.Files when route is Files', () => { const result = getNotificationType(ApplicationRoute.Files); expect(result).toBe(MenuI18nKey.Files); }); - it('should return MenuI18nKey.Applications when route is AssetsApplications', () => { + test('should return MenuI18nKey.Applications when route is AssetsApplications', () => { const result = getNotificationType(ApplicationRoute.AssetsApplications); expect(result).toBe(MenuI18nKey.Applications); }); - it('should return MenuI18nKey.Applications when route is AssetsToolsets', () => { + test('should return MenuI18nKey.Applications when route is AssetsToolsets', () => { const result = getNotificationType(ApplicationRoute.AssetsToolsets); expect(result).toBe(MenuI18nKey.Toolsets); }); - it('should return an empty string when route is undefined or not matching any of the routes', () => { + test('should return an empty string when route is undefined or not matching any of the routes', () => { const resultWithUndefinedRoute = getNotificationType(); const resultWithUnknownRoute = getNotificationType('SomeOtherRoute' as ApplicationRoute); @@ -36,17 +36,17 @@ describe('getNotificationType', () => { }); describe('getExportFunction', () => { - it('should return exportPrompts when route is Prompts', () => { + test('should return exportPrompts when route is Prompts', () => { const result = getExportFunction(ApplicationRoute.Prompts); expect(result).toBe(exportPrompts); }); - it('should return exportFiles when route is Files', () => { + test('should return exportFiles when route is Files', () => { const result = getExportFunction(ApplicationRoute.Files); expect(result).toBe(exportFiles); }); - it('should return null when route is undefined or does not match any known route', () => { + test('should return null when route is undefined or does not match any known route', () => { const resultWithUndefinedRoute = getExportFunction(); const resultWithUnknownRoute = getExportFunction('SomeOtherRoute' as ApplicationRoute); @@ -56,27 +56,27 @@ describe('getExportFunction', () => { }); describe('getJsonFileName', () => { - it('should return "prompts" when route is Prompts', () => { + test('should return "prompts" when route is Prompts', () => { const result = getJsonFileName(ApplicationRoute.Prompts); expect(result).toBe('prompts'); }); - it('should return "files" when route is Files', () => { + test('should return "files" when route is Files', () => { const result = getJsonFileName(ApplicationRoute.Files); expect(result).toBe('files'); }); - it('should return "applications" when route is AssetsApplications', () => { + test('should return "applications" when route is AssetsApplications', () => { const result = getJsonFileName(ApplicationRoute.AssetsApplications); expect(result).toBe('applications'); }); - it('should return "toolsets" when route is AssetsToolsets', () => { + test('should return "toolsets" when route is AssetsToolsets', () => { const result = getJsonFileName(ApplicationRoute.AssetsToolsets); expect(result).toBe('toolsets'); }); - it('should return an empty string when route is undefined or does not match any known route', () => { + test('should return an empty string when route is undefined or does not match any known route', () => { const resultWithUndefinedRoute = getJsonFileName(); const resultWithUnknownRoute = getJsonFileName('SomeOtherRoute' as ApplicationRoute); diff --git a/apps/ai-dial-admin/src/components/ExportConfig/Preview/tests/PreviewModal.spec.tsx b/apps/ai-dial-admin/src/components/ExportConfig/Preview/tests/PreviewModal.spec.tsx index d80976848..0a640aea6 100644 --- a/apps/ai-dial-admin/src/components/ExportConfig/Preview/tests/PreviewModal.spec.tsx +++ b/apps/ai-dial-admin/src/components/ExportConfig/Preview/tests/PreviewModal.spec.tsx @@ -1,8 +1,8 @@ -import { render, screen, fireEvent, waitFor } from '@testing-library/react'; -import { describe, it, expect, vi } from 'vitest'; -import PreviewModal from '../PreviewModal'; -import { ExportType } from '@/src/types/export'; import { ButtonsI18nKey, ExportI18nKey } from '@/src/constants/i18n'; +import { ExportType } from '@/src/types/export'; +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; +import PreviewModal from '../PreviewModal'; const defaultProps = { exportRequest: { $type: ExportType.Full }, @@ -16,27 +16,27 @@ vi.mock('@/src/app/[lang]/export-config/actions', () => ({ })); describe('PreviewModal', () => { - it('renders popup and tabs', async () => { + test('renders popup and tabs', async () => { render(); expect(screen.getByText(ExportI18nKey.FilePreview)).toBeInTheDocument(); await waitFor(() => expect(screen.getByRole('status')).toBeInTheDocument()); }); - it('calls onClose when cancel button is clicked', async () => { + test('calls onClose when cancel button is clicked', async () => { render(); const cancelBtn = await screen.getByRole('button', { name: ButtonsI18nKey.Cancel }); fireEvent.click(cancelBtn); expect(defaultProps.onClose).toHaveBeenCalled(); }); - it('calls onPrepare when export button is clicked', async () => { + test('calls onPrepare when export button is clicked', async () => { render(); const exportBtn = await screen.getByRole('button', { name: ButtonsI18nKey.Export }); fireEvent.click(exportBtn); expect(defaultProps.onPrepare).toHaveBeenCalled(); }); - it('toggles secret switch', async () => { + test('toggles secret switch', async () => { render(); const switchLabel = await screen.findByText(ExportI18nKey.IncludeSecrets); expect(switchLabel).toBeInTheDocument(); diff --git a/apps/ai-dial-admin/src/components/ExportConfig/tests/ExportConfig.spec.tsx b/apps/ai-dial-admin/src/components/ExportConfig/tests/ExportConfig.spec.tsx index 5db0ef85a..4f26698b8 100644 --- a/apps/ai-dial-admin/src/components/ExportConfig/tests/ExportConfig.spec.tsx +++ b/apps/ai-dial-admin/src/components/ExportConfig/tests/ExportConfig.spec.tsx @@ -1,7 +1,6 @@ -import { fireEvent, render, screen } from '@testing-library/react'; -import { describe, expect, it, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; import ExportConfig from '../ExportConfig'; -import { ButtonsI18nKey } from '@/src/constants/i18n'; vi.mock('@/src/app/[lang]/export-config/actions', async (importOriginal) => { const actual = await importOriginal(); @@ -13,7 +12,7 @@ vi.mock('@/src/app/[lang]/export-config/actions', async (importOriginal) => { }); describe('ExportConfig', () => { - it('renders export config title and button', () => { + test('renders export config title and button', () => { render(); expect(screen.getByText(/ExportConfig/i)).toBeInTheDocument(); expect(screen.getByRole('button')).toBeInTheDocument(); diff --git a/apps/ai-dial-admin/src/components/Header/Header.spec.tsx b/apps/ai-dial-admin/src/components/Header/Header.spec.tsx index 719d4b0c9..94cdbdce5 100644 --- a/apps/ai-dial-admin/src/components/Header/Header.spec.tsx +++ b/apps/ai-dial-admin/src/components/Header/Header.spec.tsx @@ -1,5 +1,5 @@ -import { describe, it, expect, vi } from 'vitest'; -import { render, screen, fireEvent } from '@testing-library/react'; +import { fireEvent, render, screen } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; import Header from './Header'; vi.mock('next-auth/react', () => ({ @@ -9,12 +9,12 @@ vi.mock('next-auth/react', () => ({ })); describe('Header', () => { - it('renders logo, user, and breadcrumbs', () => { + test('renders logo, user, and breadcrumbs', () => { render(
); expect(screen.getByText('Admin')).toBeInTheDocument(); }); - it('calls toggleSidebar when menu button is clicked', () => { + test('calls toggleSidebar when menu button is clicked', () => { const { getByRole } = render(
); const button = getByRole('button', { name: 'menu' }); fireEvent.click(button); diff --git a/apps/ai-dial-admin/src/components/Header/User/ProfileButton.spec.tsx b/apps/ai-dial-admin/src/components/Header/User/ProfileButton.spec.tsx index 61a837d60..aed2c1d22 100644 --- a/apps/ai-dial-admin/src/components/Header/User/ProfileButton.spec.tsx +++ b/apps/ai-dial-admin/src/components/Header/User/ProfileButton.spec.tsx @@ -1,5 +1,5 @@ -import { render, screen, fireEvent } from '@testing-library/react'; -import { describe, it, expect, vi } from 'vitest'; +import { fireEvent, render, screen } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; import ProfileButton from './ProfileButton'; const toggleUserMenu = vi.fn(); @@ -9,12 +9,12 @@ vi.mock('@/src/context/AppContext', () => ({ })); describe('ProfileButton', () => { - it('renders user icon when no image and menu closed', () => { + test('renders user icon when no image and menu closed', () => { render(); expect(screen.getByLabelText('Account settings')).toBeInTheDocument(); }); - it('calls toggleUserMenu on click', () => { + test('calls toggleUserMenu on click', () => { render(); fireEvent.click(screen.getByLabelText('Account settings')); expect(toggleUserMenu).toHaveBeenCalled(); diff --git a/apps/ai-dial-admin/src/components/InterceptorTemplates/View/View.spec.tsx b/apps/ai-dial-admin/src/components/InterceptorTemplates/View/View.spec.tsx index 9c8fba688..9eef9efb0 100644 --- a/apps/ai-dial-admin/src/components/InterceptorTemplates/View/View.spec.tsx +++ b/apps/ai-dial-admin/src/components/InterceptorTemplates/View/View.spec.tsx @@ -1,11 +1,10 @@ -import { describe, expect, it } from 'vitest'; import { render, screen } from '@testing-library/react'; +import { describe, expect, test } from 'vitest'; import { InterceptorTemplate } from '@/src/models/interceptor-template'; -import { ApplicationRoute } from '@/src/types/routes'; +import { ButtonsI18nKey, EntityFieldsI18nKey, FeaturesI18nKey } from '@/src/constants/i18n'; import View from './View'; -import { BasicI18nKey, ButtonsI18nKey, EntityFieldsI18nKey, FeaturesI18nKey } from '@/src/constants/i18n'; const template: InterceptorTemplate = { name: 'test-template', @@ -16,7 +15,7 @@ const template: InterceptorTemplate = { }; describe('View', () => { - it('Should render correctly', () => { + test('Should render correctly', () => { render(); expect(screen.getByRole('button', { name: ButtonsI18nKey.Delete })).toBeInTheDocument(); diff --git a/apps/ai-dial-admin/src/components/Menu/Menu.spec.tsx b/apps/ai-dial-admin/src/components/Menu/Menu.spec.tsx index efe4c3fb6..dcc502aac 100644 --- a/apps/ai-dial-admin/src/components/Menu/Menu.spec.tsx +++ b/apps/ai-dial-admin/src/components/Menu/Menu.spec.tsx @@ -1,7 +1,7 @@ -import { describe, it, expect, vi } from 'vitest'; import { render, screen } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; +import { MenuI18nKey } from '@/src/constants/i18n'; import Menu from './Menu'; -import { MenuI18nKey } from '../../constants/i18n'; vi.mock('next/navigation', () => ({ usePathname: () => 'en', @@ -9,7 +9,7 @@ vi.mock('next/navigation', () => ({ })); describe('Menu', () => { - it('renders Sidebar and MenuContent with open state', () => { + test('renders Sidebar and MenuContent with open state', () => { render(); expect(screen.getByText(MenuI18nKey.AccessManagement)).toBeInTheDocument(); }); diff --git a/apps/ai-dial-admin/src/components/ModelView/ModelProperties/tests/ModelProperties.spec.tsx b/apps/ai-dial-admin/src/components/ModelView/ModelProperties/tests/ModelProperties.spec.tsx index 67c2b9889..0082c6384 100644 --- a/apps/ai-dial-admin/src/components/ModelView/ModelProperties/tests/ModelProperties.spec.tsx +++ b/apps/ai-dial-admin/src/components/ModelView/ModelProperties/tests/ModelProperties.spec.tsx @@ -1,7 +1,6 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest'; -import { render, screen, fireEvent } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; import ModelProperties from '../ModelProperties'; -import { ApplicationRoute } from '@/src/types/routes'; const mockUpdateModel = vi.fn(); const baseModel = { @@ -15,7 +14,7 @@ describe('ModelProperties', () => { mockUpdateModel.mockClear(); }); - it('renders all main subcomponents', () => { + test('renders all main subcomponents', () => { render( { - it('renders title', () => { + test('renders title', () => { render(); expect(screen.getByText('Dynamic Title')).toBeInTheDocument(); }); - it('calls onClose when close button is clicked', () => { + test('calls onClose when close button is clicked', () => { render(); const closeBtn = screen.getAllByRole('button')[1]; fireEvent.click(closeBtn); expect(baseProps.onClose).toHaveBeenCalled(); }); - it('shows file details when details button is clicked', () => { + test('shows file details when details button is clicked', () => { const downloadDetails = [{ id: '1', name: 'file1', progress: 50, failed: false, complete: false }]; render(); const detailsBtn = screen.getAllByRole('button')[0]; diff --git a/apps/ai-dial-admin/src/components/Notification/tests/Notification.spec.tsx b/apps/ai-dial-admin/src/components/Notification/tests/Notification.spec.tsx index eb61dd219..cf6b93e2a 100644 --- a/apps/ai-dial-admin/src/components/Notification/tests/Notification.spec.tsx +++ b/apps/ai-dial-admin/src/components/Notification/tests/Notification.spec.tsx @@ -1,10 +1,10 @@ -import { render, screen, fireEvent } from '@testing-library/react'; -import { describe, it, expect, vi } from 'vitest'; -import Notification from '../Notification'; import { NotificationType } from '@/src/models/notification'; +import { fireEvent, render, screen } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; +import Notification from '../Notification'; describe('Notification', () => { - it('renders title and description', () => { + test('renders title and description', () => { render( { expect(screen.getByText('Everything went well.')).toBeInTheDocument(); }); - it('renders all notification types', () => { + test('renders all notification types', () => { Object.values(NotificationType).forEach((type) => { render(); expect(screen.getByText(type)).toBeInTheDocument(); }); }); - it('calls onClose when close button is clicked', () => { + test('calls onClose when close button is clicked', () => { const onClose = vi.fn(); render(); const closeBtn = screen.getByLabelText('close'); @@ -33,7 +33,7 @@ describe('Notification', () => { expect(onClose).toHaveBeenCalled(); }); - it('does not render description if not provided', () => { + test('does not render description if not provided', () => { render(); expect(screen.queryByText('tiny text-secondary break-words whitespace-pre-wrap mt-2')).not.toBeInTheDocument(); }); diff --git a/apps/ai-dial-admin/src/components/Notification/tests/NotificationPortal.spec.tsx b/apps/ai-dial-admin/src/components/Notification/tests/NotificationPortal.spec.tsx index 4877dcbbe..a4d998d51 100644 --- a/apps/ai-dial-admin/src/components/Notification/tests/NotificationPortal.spec.tsx +++ b/apps/ai-dial-admin/src/components/Notification/tests/NotificationPortal.spec.tsx @@ -1,10 +1,10 @@ +import { NotificationType } from '@/src/models/notification'; import { render, screen } from '@testing-library/react'; -import { describe, it, expect, vi } from 'vitest'; +import { describe, expect, test, vi } from 'vitest'; import NotificationPortal from '../NotificationPortal'; -import { NotificationType } from '@/src/models/notification'; describe('NotificationPortal', () => { - it('renders Notification for non-dynamic notifications', () => { + test('renders Notification for non-dynamic notifications', () => { render( { expect(screen.getByText('Success')).toBeInTheDocument(); }); - it('renders DynamicNotification for dynamic notifications', () => { + test('renders DynamicNotification for dynamic notifications', () => { render( { expect(screen.getByText('Dynamic')).toBeInTheDocument(); }); - it('renders multiple notifications', () => { + test('renders multiple notifications', () => { render( { - it('calls onClose when close button is clicked', () => { + test('calls onClose when close button is clicked', () => { render(); fireEvent.click(screen.getByLabelText(ButtonsI18nKey.Close)); expect(baseProps.onClose).toHaveBeenCalled(); diff --git a/apps/ai-dial-admin/src/components/Telemetry/TelemetryControls/Filters/tests/Filter.spec.tsx b/apps/ai-dial-admin/src/components/Telemetry/TelemetryControls/Filters/tests/Filter.spec.tsx index 936dee77b..8767b2fce 100644 --- a/apps/ai-dial-admin/src/components/Telemetry/TelemetryControls/Filters/tests/Filter.spec.tsx +++ b/apps/ai-dial-admin/src/components/Telemetry/TelemetryControls/Filters/tests/Filter.spec.tsx @@ -1,13 +1,13 @@ -import { describe, it, expect, vi } from 'vitest'; -import { render, screen, fireEvent } from '@testing-library/react'; -import Filter from '../Filter'; import { ApplicationRoute } from '@/src/types/routes'; +import { fireEvent, render, screen } from '@testing-library/react'; +import { describe, expect, test, vi } from 'vitest'; +import Filter from '../Filter'; const baseFilterData = { type: 'Project', condition: 'Equal', value: 'val' }; const baseDropdownData = { projects: [], entities: [] }; describe('Filter', () => { - it('renders filter type, condition icon, and value', () => { + test('renders filter type, condition icon, and value', () => { render( { expect(screen.getByText('val')).toBeInTheDocument(); }); - it('calls onClose when close button is clicked', () => { + test('calls onClose when close button is clicked', () => { const onClose = vi.fn(); render( { expect(onClose).toHaveBeenCalledWith(2); }); - it('calls onEdit when addFilter is triggered', () => { + test('calls onEdit when addFilter is triggered', () => { const onEdit = vi.fn(); // AddFilter is mocked to just render children, so we call addFilter manually render( diff --git a/apps/ai-dial-admin/src/components/Toolsets/Tools/utils.spec.ts b/apps/ai-dial-admin/src/components/Toolsets/Tools/utils.spec.ts index 7299348cc..c5867cff6 100644 --- a/apps/ai-dial-admin/src/components/Toolsets/Tools/utils.spec.ts +++ b/apps/ai-dial-admin/src/components/Toolsets/Tools/utils.spec.ts @@ -1,32 +1,32 @@ -import { describe, it, expect } from 'vitest'; -import { getFilteredTools } from './utils'; +import { describe, test, expect } from 'vitest'; import { ToolFilter } from './type'; +import { getFilteredTools } from './utils'; describe('getFilteredTools', () => { const tools = ['toolA', 'toolB', 'toolC']; const availableTools = [{ name: 'toolA' }, { name: 'toolC' }, { name: 'toolD' }]; - it('returns enabled tools', () => { + test('returns enabled tools', () => { const result = getFilteredTools(tools, [ToolFilter.Enabled], availableTools); expect(result).toEqual(['toolA', 'toolC']); }); - it('returns disabled tools', () => { + test('returns disabled tools', () => { const result = getFilteredTools(tools, [ToolFilter.Disabled], availableTools); expect(result).toEqual(['toolD']); }); - it('returns auto detected tools', () => { + test('returns auto detected tools', () => { const result = getFilteredTools(tools, [ToolFilter.AutoDetected], availableTools); expect(result).toEqual(['toolA', 'toolC', 'toolD']); }); - it('returns added manually tools', () => { + test('returns added manually tools', () => { const result = getFilteredTools(tools, [ToolFilter.AddedManually], availableTools); expect(result).toEqual(['toolB']); }); - it('returns unique tools when multiple filters', () => { + test('returns unique tools when multiple filters', () => { const result = getFilteredTools( tools, [ToolFilter.Enabled, ToolFilter.Disabled, ToolFilter.AutoDetected, ToolFilter.AddedManually], @@ -35,7 +35,7 @@ describe('getFilteredTools', () => { expect(result.sort()).toEqual(['toolA', 'toolB', 'toolC', 'toolD'].sort()); }); - it('returns empty array if no filters', () => { + test('returns empty array if no filters', () => { const result = getFilteredTools(tools, [], availableTools); expect(result).toEqual([]); }); diff --git a/apps/ai-dial-admin/src/components/UpstreamEndpoints/Endpoint/Endpoint.spec.tsx b/apps/ai-dial-admin/src/components/UpstreamEndpoints/Endpoint/Endpoint.spec.tsx index 32e7b4d16..c27e22a06 100644 --- a/apps/ai-dial-admin/src/components/UpstreamEndpoints/Endpoint/Endpoint.spec.tsx +++ b/apps/ai-dial-admin/src/components/UpstreamEndpoints/Endpoint/Endpoint.spec.tsx @@ -1,7 +1,7 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest'; -import { render, screen, fireEvent } from '@testing-library/react'; -import Endpoint from './Endpoint'; import { ButtonsI18nKey, EntityFieldsI18nKey, EntityPlaceholdersI18nKey } from '@/src/constants/i18n'; +import { fireEvent, render, screen } from '@testing-library/react'; +import { beforeEach, describe, expect, test, vi } from 'vitest'; +import Endpoint from './Endpoint'; const baseEndpoint = { endpoint: 'http://test', @@ -20,7 +20,7 @@ describe('Endpoint', () => { removeEndpoint = vi.fn(); }); - it('renders all main fields and remove button', () => { + test('renders all main fields and remove button', () => { render( { expect(screen.getByLabelText('remove')).toBeInTheDocument(); }); - it('calls updateEndpoint on endpoint url change', () => { + test('calls updateEndpoint on endpoint url change', () => { render( { expect(updateEndpoint).toHaveBeenCalledWith({ ...baseEndpoint, endpoint: 'new-url' }); }); - it('calls updateEndpoint on key, weight, and tier change', () => { + test('calls updateEndpoint on key, weight, and tier change', () => { render( { expect(updateEndpoint).toHaveBeenCalledWith({ ...baseEndpoint, tier: 3 }); }); - it('calls removeEndpoint on remove button click', () => { + test('calls removeEndpoint on remove button click', () => { render( { expect(removeEndpoint).toHaveBeenCalledWith(0); }); - it('does not render remove button if readonly', () => { + test('does not render remove button if readonly', () => { render( ({ id: 'ep1', extraData }) as any; @@ -16,13 +16,13 @@ describe('ExtraDataField', () => { baseProps.onChangeExtraData.mockClear(); }); - it('renders with no extraData (NONE_ID)', () => { + test('renders with no extraData (NONE_ID)', () => { render(); expect(screen.getByText('Extra Data')).toBeInTheDocument(); expect(screen.getByText(BasicI18nKey.None)).toBeInTheDocument(); }); - it('renders with string extraData (USE_STRING_ID)', () => { + test('renders with string extraData (USE_STRING_ID)', () => { render(); expect(screen.getByText('hello')).toBeInTheDocument(); }); diff --git a/apps/ai-dial-admin/src/server/tests/deployments-api.spec.ts b/apps/ai-dial-admin/src/server/tests/deployments-api.spec.ts index 2af01f88b..5e742443d 100644 --- a/apps/ai-dial-admin/src/server/tests/deployments-api.spec.ts +++ b/apps/ai-dial-admin/src/server/tests/deployments-api.spec.ts @@ -1,4 +1,4 @@ -import { describe, it, expect, vi } from 'vitest'; +import { describe, test, expect, vi } from 'vitest'; import { DeploymentsApi, BASE_CONTAINERS_URL } from '../deployments-api'; import createFetchMock from 'vitest-fetch-mock'; import { TEST_URL, TOKEN_MOCK } from '@/src/utils/tests/mock/api.mock'; @@ -8,7 +8,7 @@ fetch.enableMocks(); describe('DeploymentsApi', () => { const instance = new DeploymentsApi({ host: TEST_URL }); - it('calls getInterceptorContainers with correct URL and token', async () => { + test('calls getInterceptorContainers with correct URL and token', async () => { fetch.mockResponseOnce(['container1']); await instance.getInterceptorContainers(TOKEN_MOCK); expect(fetch).toHaveBeenCalledWith( @@ -19,7 +19,7 @@ describe('DeploymentsApi', () => { ); }); - it('calls getModelContainers with correct URL and token', async () => { + test('calls getModelContainers with correct URL and token', async () => { fetch.mockResponseOnce(['container2']); await instance.getModelContainers(TOKEN_MOCK); expect(fetch).toHaveBeenCalledWith( @@ -30,7 +30,7 @@ describe('DeploymentsApi', () => { ); }); - it('calls getMcpContainers with correct URL and token', async () => { + test('calls getMcpContainers with correct URL and token', async () => { fetch.mockResponseOnce(['container2']); await instance.getMcpContainers(TOKEN_MOCK); expect(fetch).toHaveBeenCalledWith( diff --git a/apps/ai-dial-admin/src/utils/entities/tests/create-enetity.spec.ts b/apps/ai-dial-admin/src/utils/entities/tests/create-enetity.spec.ts index b4852e493..de2d55148 100644 --- a/apps/ai-dial-admin/src/utils/entities/tests/create-enetity.spec.ts +++ b/apps/ai-dial-admin/src/utils/entities/tests/create-enetity.spec.ts @@ -1,22 +1,22 @@ import { CreateI18nKey } from '@/src/constants/i18n'; import { ApplicationRoute } from '@/src/types/routes'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, test } from 'vitest'; import { getCreateEntityTitle, getCreateNotificationDescription, getCreateNotificationTitle } from '../create-entity'; describe('Create :: utils', () => { const tWithProps = (str: string, props?: Record) => str + ' with props'; - it('getCreateEntityTitle returns a string', () => { + test('getCreateEntityTitle returns a string', () => { expect(getCreateEntityTitle(ApplicationRoute.Applications, tWithProps)).toBe(`${CreateI18nKey.Title} with props`); }); - it('getCreateNotificationTitle returns a string', () => { + test('getCreateNotificationTitle returns a string', () => { expect(getCreateNotificationTitle(ApplicationRoute.Interceptors, tWithProps)).toBe( `${CreateI18nKey.NotificationTitle} with props`, ); }); - it('getCreateNotificationDescription returns a string', () => { + test('getCreateNotificationDescription returns a string', () => { expect(getCreateNotificationDescription(ApplicationRoute.Interceptors, 'aa', tWithProps)).toBe( `${CreateI18nKey.NotificationDescription} with props`, ); diff --git a/apps/ai-dial-admin/src/utils/entities/tests/filter-names.spec.ts b/apps/ai-dial-admin/src/utils/entities/tests/filter-names.spec.ts index b7b929dc8..92de0c5f0 100644 --- a/apps/ai-dial-admin/src/utils/entities/tests/filter-names.spec.ts +++ b/apps/ai-dial-admin/src/utils/entities/tests/filter-names.spec.ts @@ -1,51 +1,51 @@ -import { describe, it, expect } from 'vitest'; +import { describe, test, expect } from 'vitest'; import { filterDisplayNames, filterNames } from '../filter-names'; describe('filterDisplayNames', () => { - it('returns display names from entities', () => { + test('returns display names from entities', () => { const entities = [{ displayName: 'Entity1' }, { displayName: 'Entity2' }, { displayName: null }, {}]; expect(filterDisplayNames(entities)).toEqual(['Entity1', 'Entity2']); }); - it('returns empty array if entities is undefined', () => { + test('returns empty array if entities is undefined', () => { expect(filterDisplayNames(undefined)).toEqual([]); }); - it('returns empty array if entities is null', () => { + test('returns empty array if entities is null', () => { expect(filterDisplayNames(null)).toEqual([]); }); - it('returns empty array if no displayName present', () => { + test('returns empty array if no displayName present', () => { const entities = [{}, { displayName: null }]; expect(filterDisplayNames(entities)).toEqual([]); }); - it('returns array without current entity displayName', () => { + test('returns array without current entity displayName', () => { const entities = [{ displayName: 'Entity1' }, { displayName: 'Entity2' }, { displayName: null }, {}]; expect(filterDisplayNames(entities, 'Entity1')).toEqual(['Entity2']); }); }); describe('filterNames', () => { - it('returns display names from entities', () => { + test('returns display names from entities', () => { const entities = [{ name: 'Entity1' }, { name: 'Entity2' }, { name: null }, {}]; expect(filterNames(entities)).toEqual(['Entity1', 'Entity2']); }); - it('returns empty array if entities is undefined', () => { + test('returns empty array if entities is undefined', () => { expect(filterNames(undefined)).toEqual([]); }); - it('returns empty array if entities is null', () => { + test('returns empty array if entities is null', () => { expect(filterNames(null)).toEqual([]); }); - it('returns empty array if no displayName present', () => { + test('returns empty array if no displayName present', () => { const entities = [{}, { name: null }]; expect(filterNames(entities)).toEqual([]); }); - it('returns array without current entity тame', () => { + test('returns array without current entity тame', () => { const entities = [{ name: 'Entity1' }, { name: 'Entity2' }, { name: null }, {}]; expect(filterNames(entities, 'Entity1')).toEqual(['Entity2']); }); diff --git a/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts b/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts index 13db21a88..9b797506f 100644 --- a/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts +++ b/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts @@ -1,6 +1,6 @@ import { RollbackI18nKey } from '@/src/constants/i18n'; import { ActivityAuditResourceType } from '@/src/types/activity-audit'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, test } from 'vitest'; import { getRollbackErrorDescription, getRollbackErrorTitle, @@ -11,25 +11,25 @@ import { describe('Rollback :: utils', () => { const tWithProps = (str: string, props?: Record) => str + ' with props'; - it('getRollbackSuccessTitle returns a string', () => { + test('getRollbackSuccessTitle returns a string', () => { expect(getRollbackSuccessTitle(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationSuccessTitle} with props`, ); }); - it('getRollbackSuccessDescription returns a string', () => { + test('getRollbackSuccessDescription returns a string', () => { expect(getRollbackSuccessDescription(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationSuccessDescription} with props`, ); }); - it('getRollbackErrorTitle returns a string', () => { + test('getRollbackErrorTitle returns a string', () => { expect(getRollbackErrorTitle(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationErrorTitle} with props`, ); }); - it('getRollbackErrorDescription returns a string', () => { + test('getRollbackErrorDescription returns a string', () => { expect(getRollbackErrorDescription(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationErrorDescription} with props`, ); diff --git a/apps/ai-dial-admin/src/utils/entities/tests/update-entity.spec.ts b/apps/ai-dial-admin/src/utils/entities/tests/update-entity.spec.ts index 550595e79..536592c72 100644 --- a/apps/ai-dial-admin/src/utils/entities/tests/update-entity.spec.ts +++ b/apps/ai-dial-admin/src/utils/entities/tests/update-entity.spec.ts @@ -1,18 +1,18 @@ import { UpdateI18nKey } from '@/src/constants/i18n'; import { ApplicationRoute } from '@/src/types/routes'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, test } from 'vitest'; import { getUpdateNotificationDescription, getUpdateNotificationTitle } from '../update-entity'; describe('Update :: utils', () => { const tWithProps = (str: string, props?: Record) => str + ' with props'; - it('getUpdateNotificationTitle returns a string', () => { + test('getUpdateNotificationTitle returns a string', () => { expect(getUpdateNotificationTitle(ApplicationRoute.Interceptors, tWithProps)).toBe( `${UpdateI18nKey.NotificationTitle} with props`, ); }); - it('getUpdateNotificationDescription returns a string', () => { + test('getUpdateNotificationDescription returns a string', () => { expect(getUpdateNotificationDescription(ApplicationRoute.Interceptors, 'aa', tWithProps)).toBe( `${UpdateI18nKey.NotificationDescription} with props`, ); From 61bf51adf59413f6040a90344d125ff61b0143cd Mon Sep 17 00:00:00 2001 From: Polina Date: Fri, 31 Oct 2025 15:32:18 +0100 Subject: [PATCH 4/6] fix tests --- .../src/utils/entities/tests/rollback-entity.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts b/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts index 9b797506f..061f61f51 100644 --- a/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts +++ b/apps/ai-dial-admin/src/utils/entities/tests/rollback-entity.spec.ts @@ -11,25 +11,25 @@ import { describe('Rollback :: utils', () => { const tWithProps = (str: string, props?: Record) => str + ' with props'; - test('getRollbackSuccessTitle returns a string', () => { + test('getRollbackSuccessTitle returns a string', () => { expect(getRollbackSuccessTitle(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationSuccessTitle} with props`, ); }); - test('getRollbackSuccessDescription returns a string', () => { + test('getRollbackSuccessDescription returns a string', () => { expect(getRollbackSuccessDescription(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationSuccessDescription} with props`, ); }); - test('getRollbackErrorTitle returns a string', () => { + test('getRollbackErrorTitle returns a string', () => { expect(getRollbackErrorTitle(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationErrorTitle} with props`, ); }); - test('getRollbackErrorDescription returns a string', () => { + test('getRollbackErrorDescription returns a string', () => { expect(getRollbackErrorDescription(ActivityAuditResourceType.INTERCEPTOR, tWithProps)).toBe( `${RollbackI18nKey.NotificationErrorDescription} with props`, ); From d4df3d8e174ad6eafddf01dc42ff29a20c544bfe Mon Sep 17 00:00:00 2001 From: Polina Date: Fri, 31 Oct 2025 15:33:55 +0100 Subject: [PATCH 5/6] fix build --- apps/ai-dial-admin/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/ai-dial-admin/tsconfig.json b/apps/ai-dial-admin/tsconfig.json index d8489a33d..eca7a3f0b 100644 --- a/apps/ai-dial-admin/tsconfig.json +++ b/apps/ai-dial-admin/tsconfig.json @@ -1,10 +1,10 @@ { "compilerOptions": { "jsx": "preserve", - "allowJs": false, + "allowJs": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "strict": true, + "forceConsistentCasingInFileNames": true, "noEmit": true, "incremental": true, "resolveJsonModule": true, From 600e22254255bb66d58af035c76b038ba9be1bd7 Mon Sep 17 00:00:00 2001 From: Polina Date: Fri, 31 Oct 2025 15:43:58 +0100 Subject: [PATCH 6/6] fix types --- apps/ai-dial-admin/tsconfig.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/ai-dial-admin/tsconfig.json b/apps/ai-dial-admin/tsconfig.json index eca7a3f0b..485ce8bcb 100644 --- a/apps/ai-dial-admin/tsconfig.json +++ b/apps/ai-dial-admin/tsconfig.json @@ -16,7 +16,12 @@ ] }, "files": [], - "include": [".next/types/**/*.ts"], + "include": [ + "../../apps/ai-dial-admin/.next/types/**/*.ts", + "../../dist/apps/ai-dial-admin/.next/types/**/*.ts", + "next-env.d.ts", + ".next/types/**/*.ts" + ], "references": [ { "path": "./tsconfig.app.json"