Skip to content

Commit 520783c

Browse files
fix: alias in spec.ts files (#931)
1 parent 6f609db commit 520783c

File tree

35 files changed

+199
-167
lines changed

35 files changed

+199
-167
lines changed

apps/ai-dial-admin/src/app/[lang]/interceptor-templates/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { SaveValidationContextProvider } from '@/src/context/SaveValidationConte
1010
import { DEFAULT_ETAG } from '@/src/constants/api-headers';
1111
import { InterceptorTemplate } from '@/src/models/interceptor-template';
1212
import { DialInterceptor } from '@/src/models/dial/interceptor';
13-
import { getInterceptorsList } from '../../interceptors/actions';
13+
import { getInterceptorsList } from '@/src/app/[lang]/interceptors/actions';
1414
import { filterNames } from '@/src/utils/entities/filter-names';
1515
import { ApplicationRoute } from '@/src/types/routes';
1616
import { getIsEnableAuthToggle } from '@/src/utils/env/get-auth-toggle';

apps/ai-dial-admin/src/components/AddEntitiesTab/tests/AddEntitiesView.spec.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { render, screen, fireEvent } from '@testing-library/react';
2-
import { describe, it, expect, vi } from 'vitest';
3-
import AddEntitiesView from '../AddEntitiesView';
41
import { ButtonsI18nKey, EntitiesI18nKey } from '@/src/constants/i18n';
2+
import { fireEvent, render, screen } from '@testing-library/react';
3+
import { describe, expect, test, vi } from 'vitest';
4+
import AddEntitiesView from '../AddEntitiesView';
55

66
// Mock createPortal to render modal content inline for test simplicity
77
vi.mock('react-dom', () => ({
@@ -10,7 +10,7 @@ vi.mock('react-dom', () => ({
1010
}));
1111

1212
describe('AddEntitiesView', () => {
13-
it('renders the view title and entity count', () => {
13+
test('renders the view title and entity count', () => {
1414
const customColumns = [{ field: 'custom', headerName: 'Custom' }];
1515
render(
1616
<AddEntitiesView
@@ -25,7 +25,7 @@ describe('AddEntitiesView', () => {
2525
expect(screen.getByText(EntitiesI18nKey.NoEntities)).toBeInTheDocument();
2626
});
2727

28-
it('calls onAdd when AddEntitiesGrid onApply is triggered', () => {
28+
test('calls onAdd when AddEntitiesGrid onApply is triggered', () => {
2929
const onAdd = vi.fn();
3030
const models = [{ id: '1', name: 'Model1' }];
3131
render(<AddEntitiesView models={models} applications={[]} roles={[]} keys={[]} onAdd={onAdd} />);
@@ -37,14 +37,14 @@ describe('AddEntitiesView', () => {
3737
fireEvent.click(modalButtons[1]);
3838
});
3939

40-
it('calls onRemove when remove operation is triggered', () => {
40+
test('calls onRemove when remove operation is triggered', () => {
4141
const onRemove = vi.fn();
4242
const models = [{ id: '1', name: 'Model1' }];
4343
render(<AddEntitiesView models={models} applications={[]} roles={[]} keys={[]} onRemove={onRemove} />);
4444
expect(typeof onRemove).toBe('function');
4545
});
4646

47-
it('renders with getRelevantDataForEntity', () => {
47+
test('renders with getRelevantDataForEntity', () => {
4848
const getRelevantDataForEntity = vi.fn(() => []);
4949
render(
5050
<AddEntitiesView

apps/ai-dial-admin/src/components/Charts/SingleValueChart/SingleValueChart.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render, screen } from '@testing-library/react';
22
import SingleValueChart from './SingleValueChart';
3-
import { describe, it, expect, vi } from 'vitest';
3+
import { describe, it, expect, vi, test } from 'vitest';
44
import { BasicI18nKey } from '@/src/constants/i18n';
55

66
const validQuery = {
@@ -20,17 +20,17 @@ const defaultProps = {
2020
};
2121

2222
describe('SingleValueChart', () => {
23-
it('renders the title as text', () => {
23+
test('renders the title as text', () => {
2424
render(<SingleValueChart {...defaultProps} />);
2525
expect(screen.getByText('Test Title')).toBeInTheDocument();
2626
});
2727

28-
it('renders the unit if provided', async () => {
28+
test('renders the unit if provided', async () => {
2929
render(<SingleValueChart {...defaultProps} />);
3030
expect(await screen.findByText('ms')).toBeInTheDocument();
3131
});
3232

33-
it('renders NoDataContent if data is null', async () => {
33+
test('renders NoDataContent if data is null', async () => {
3434
mockGetData.mockResolvedValueOnce({ success: false } as any);
3535
render(<SingleValueChart {...defaultProps} />);
3636
expect(await screen.findByText(BasicI18nKey.NoData)).toBeInTheDocument();

apps/ai-dial-admin/src/components/Common/AttachmentInput/AttachmentInput.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render, screen, within } from '@testing-library/react';
22
import userEvent from '@testing-library/user-event';
3-
import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';
3+
import { afterEach, beforeAll, describe, expect, it, test, vi } from 'vitest';
44

55
import AttachmentInput from './AttachmentInput';
66
import { AttachmentsI18nKey } from '@/src/constants/i18n';
@@ -26,14 +26,14 @@ const options = [
2626
];
2727

2828
describe('Common components - AttachmentInput', () => {
29-
it('renders tags from initialValues', () => {
29+
test('renders tags from initialValues', () => {
3030
render(<AttachmentInput availableItems={options} initialValues={['pdf']} />);
3131

3232
expect(screen.getByText('PDF')).toBeInTheDocument();
3333
expect(screen.getByRole('button', { name: AttachmentsI18nKey.UseAll })).toBeInTheDocument();
3434
});
3535

36-
it('filters suggestions while typing and adds one on click', async () => {
36+
test('filters suggestions while typing and adds one on click', async () => {
3737
const onChange = vi.fn();
3838
render(<AttachmentInput availableItems={options} onChange={onChange} />);
3939

@@ -50,7 +50,7 @@ describe('Common components - AttachmentInput', () => {
5050
expect(screen.queryByRole('list ')).toBeNull();
5151
});
5252

53-
it('selects all items with the “Select all” button and resets on remove', async () => {
53+
test('selects all items with the “Select all” button and resets on remove', async () => {
5454
const onChange = vi.fn();
5555
render(<AttachmentInput availableItems={options} onChange={onChange} allValueLabel="ALL VALUES" />);
5656

apps/ai-dial-admin/src/components/Common/FolderList/FolderList.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { EntitiesI18nKey } from '@/src/constants/i18n';
12
import { render, screen } from '@testing-library/react';
2-
import { describe, it, expect } from 'vitest';
3+
import { describe, expect, test } from 'vitest';
34
import FolderList from './FolderList';
4-
import { EntitiesI18nKey } from '@/src/constants/i18n';
55

66
const fakeContext = () => ({
77
files: [],
@@ -16,7 +16,7 @@ const fakeContext = () => ({
1616
});
1717

1818
describe('FolderList', () => {
19-
it('renders no data message when files are empty', () => {
19+
test('renders no data message when files are empty', () => {
2020
render(<FolderList context={fakeContext} />);
2121
expect(screen.getByText(EntitiesI18nKey.NoFolders)).toBeInTheDocument();
2222
});

apps/ai-dial-admin/src/components/Common/LabelledText/LabelledText.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { render, screen } from '@testing-library/react';
2-
import { describe, it, expect } from 'vitest';
2+
import { describe, expect, test } from 'vitest';
33
import LabelledText from './LabelledText';
44

55
describe('LabelledText', () => {
6-
it('renders label and text', () => {
6+
test('renders label and text', () => {
77
render(<LabelledText label="Test Label" text="Test Text" />);
88
expect(screen.getByText('Test Label')).toBeInTheDocument();
99
expect(screen.getByText('Test Text')).toBeInTheDocument();
1010
});
1111

12-
it('renders children instead of text if provided', () => {
12+
test('renders children instead of text if provided', () => {
1313
render(
1414
<LabelledText label="Child Label">
1515
<span>Child Content</span>
@@ -19,12 +19,12 @@ describe('LabelledText', () => {
1919
expect(screen.getByText('Child Label')).toBeInTheDocument();
2020
});
2121

22-
it('renders copy button if copyButton is true', () => {
22+
test('renders copy button if copyButton is true', () => {
2323
render(<LabelledText label="Copy Label" text="Copy Text" copyable />);
2424
expect(screen.getByLabelText('copy')).toBeInTheDocument();
2525
});
2626

27-
it('renders without text', () => {
27+
test('renders without text', () => {
2828
render(<LabelledText label="No Text" />);
2929
expect(screen.getByText('No Text')).toBeInTheDocument();
3030
});

apps/ai-dial-admin/src/components/Common/Multiselect/Multiselect.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render, screen } from '@testing-library/react';
2-
import { describe, expect, it } from 'vitest';
2+
import { describe, expect, test } from 'vitest';
33
import Multiselect from './Multiselect';
44

55
describe('Multiselect', () => {
6-
it('renders field title and error text', () => {
6+
test('renders field title and error text', () => {
77
render(<Multiselect elementId="id" title="Title" errorText="Error!" />);
88
expect(screen.getByText('Title')).toBeInTheDocument();
99
expect(screen.getByText('Error!')).toBeInTheDocument();

apps/ai-dial-admin/src/components/Common/ReadonlyField/ReadonlyField.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { render, screen } from '@testing-library/react';
2-
import { describe, it, expect } from 'vitest';
2+
import { describe, expect, test } from 'vitest';
33
import ReadonlyField from './ReadonlyField';
44

55
describe('ReadonlyField', () => {
6-
it('renders the title and value', () => {
6+
test('renders the title and value', () => {
77
render(<ReadonlyField title="Test Title" value="Test Value" />);
88
expect(screen.getByDisplayValue('Test Value')).toBeInTheDocument();
99
expect(screen.getByText('Test Title')).toBeInTheDocument();
1010
});
1111

12-
it('renders with empty value', () => {
12+
test('renders with empty value', () => {
1313
render(<ReadonlyField title="Empty Value" />);
1414
expect(screen.getByDisplayValue('')).toBeInTheDocument();
1515
expect(screen.getByText('Empty Value')).toBeInTheDocument();

apps/ai-dial-admin/src/components/Content/Content.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { render, screen } from '@testing-library/react';
2-
import { describe, it, expect } from 'vitest';
2+
import { describe, expect, test } from 'vitest';
33
import Content from './Content';
44

55
describe('Content', () => {
6-
it('renders children', () => {
6+
test('renders children', () => {
77
render(
88
<Content isEnableAuth={true} beVersion={'1.0.0'}>
99
<div>Test Content</div>
@@ -12,7 +12,7 @@ describe('Content', () => {
1212
expect(screen.getByText('Test Content')).toBeInTheDocument();
1313
});
1414

15-
it('renders with beVersion', () => {
15+
test('renders with beVersion', () => {
1616
render(
1717
<Content isEnableAuth={false} beVersion={'2.3.4'}>
1818
<span>Versioned</span>

apps/ai-dial-admin/src/components/EntityListView/tests/utils.spec.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ import { exportFiles } from '@/src/app/[lang]/files/actions';
22
import { exportPrompts } from '@/src/app/[lang]/prompts/actions';
33
import { MenuI18nKey } from '@/src/constants/i18n';
44
import { ApplicationRoute } from '@/src/types/routes';
5-
import { describe, expect, it } from 'vitest';
5+
import { describe, expect, test } from 'vitest';
66
import { getExportFunction, getJsonFileName, getNotificationType } from '../utils';
77

88
describe('getNotificationType', () => {
9-
it('should return MenuI18nKey.Prompts when route is Prompts', () => {
9+
test('should return MenuI18nKey.Prompts when route is Prompts', () => {
1010
const result = getNotificationType(ApplicationRoute.Prompts);
1111
expect(result).toBe(MenuI18nKey.Prompts);
1212
});
1313

14-
it('should return MenuI18nKey.Files when route is Files', () => {
14+
test('should return MenuI18nKey.Files when route is Files', () => {
1515
const result = getNotificationType(ApplicationRoute.Files);
1616
expect(result).toBe(MenuI18nKey.Files);
1717
});
1818

19-
it('should return MenuI18nKey.Applications when route is AssetsApplications', () => {
19+
test('should return MenuI18nKey.Applications when route is AssetsApplications', () => {
2020
const result = getNotificationType(ApplicationRoute.AssetsApplications);
2121
expect(result).toBe(MenuI18nKey.Applications);
2222
});
2323

24-
it('should return MenuI18nKey.Applications when route is AssetsToolsets', () => {
24+
test('should return MenuI18nKey.Applications when route is AssetsToolsets', () => {
2525
const result = getNotificationType(ApplicationRoute.AssetsToolsets);
2626
expect(result).toBe(MenuI18nKey.Toolsets);
2727
});
2828

29-
it('should return an empty string when route is undefined or not matching any of the routes', () => {
29+
test('should return an empty string when route is undefined or not matching any of the routes', () => {
3030
const resultWithUndefinedRoute = getNotificationType();
3131
const resultWithUnknownRoute = getNotificationType('SomeOtherRoute' as ApplicationRoute);
3232

@@ -36,17 +36,17 @@ describe('getNotificationType', () => {
3636
});
3737

3838
describe('getExportFunction', () => {
39-
it('should return exportPrompts when route is Prompts', () => {
39+
test('should return exportPrompts when route is Prompts', () => {
4040
const result = getExportFunction(ApplicationRoute.Prompts);
4141
expect(result).toBe(exportPrompts);
4242
});
4343

44-
it('should return exportFiles when route is Files', () => {
44+
test('should return exportFiles when route is Files', () => {
4545
const result = getExportFunction(ApplicationRoute.Files);
4646
expect(result).toBe(exportFiles);
4747
});
4848

49-
it('should return null when route is undefined or does not match any known route', () => {
49+
test('should return null when route is undefined or does not match any known route', () => {
5050
const resultWithUndefinedRoute = getExportFunction();
5151
const resultWithUnknownRoute = getExportFunction('SomeOtherRoute' as ApplicationRoute);
5252

@@ -56,27 +56,27 @@ describe('getExportFunction', () => {
5656
});
5757

5858
describe('getJsonFileName', () => {
59-
it('should return "prompts" when route is Prompts', () => {
59+
test('should return "prompts" when route is Prompts', () => {
6060
const result = getJsonFileName(ApplicationRoute.Prompts);
6161
expect(result).toBe('prompts');
6262
});
6363

64-
it('should return "files" when route is Files', () => {
64+
test('should return "files" when route is Files', () => {
6565
const result = getJsonFileName(ApplicationRoute.Files);
6666
expect(result).toBe('files');
6767
});
6868

69-
it('should return "applications" when route is AssetsApplications', () => {
69+
test('should return "applications" when route is AssetsApplications', () => {
7070
const result = getJsonFileName(ApplicationRoute.AssetsApplications);
7171
expect(result).toBe('applications');
7272
});
7373

74-
it('should return "toolsets" when route is AssetsToolsets', () => {
74+
test('should return "toolsets" when route is AssetsToolsets', () => {
7575
const result = getJsonFileName(ApplicationRoute.AssetsToolsets);
7676
expect(result).toBe('toolsets');
7777
});
7878

79-
it('should return an empty string when route is undefined or does not match any known route', () => {
79+
test('should return an empty string when route is undefined or does not match any known route', () => {
8080
const resultWithUndefinedRoute = getJsonFileName();
8181
const resultWithUnknownRoute = getJsonFileName('SomeOtherRoute' as ApplicationRoute);
8282

0 commit comments

Comments
 (0)