Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ package.json # Project dependencies and scripts
## Testing Guidelines

- Use **Vitest**.
- Place test files in the `__tests__` directory adjacent to the source file, with `.test.ts` suffix.
- Place test files adjacent to the source file, with `.test.ts` suffix.
- Use Arrange - Act - Assert (AAA) pattern for test structure:
- **Arrange:** Set up the test environment and inputs.
- **Act:** Call the function being tested.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/App.test.tsx → src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import App from '../App';
import App from './App';

describe('App', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';

import { render, screen, waitFor } from 'test/test-utils';

import Accordion from '../Accordion';
import Accordion from './Accordion';

describe('Accordion', () => {
it('should render correctly', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import ErrorAlert from '../ErrorAlert';
import ErrorAlert from './ErrorAlert';

describe('ErrorAlert', () => {
const descriptionValue = 'the description text';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, expect, it, vi } from 'vitest';

import { render, screen } from 'test/test-utils';

import Backdrop from '../Backdrop';
import Backdrop from './Backdrop';

describe('Backdrop', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import Badge from '../Badge';
import Badge from './Badge';

describe('Badge', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import Breadcrumbs from '../Breadcrumbs';
import Breadcrumbs from './Breadcrumbs';

describe('Breadcrumbs', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';

import { render, screen } from 'test/test-utils';

import Button from '../Button';
import Button from './Button';

describe('Button', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StorageKey } from 'common/utils/constants';
import { render, screen } from 'test/test-utils';
import storage from 'common/utils/storage';

import LanguageToggle from '../LanguageToggle';
import LanguageToggle from './LanguageToggle';

// mock select functions from react-i18next
const mockChangeLanguage = vi.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as UseSettings from 'common/hooks/useSettings';
import * as UseSetSettings from 'common/api/useSetSettings';
import { settingsFixture } from '__fixtures__/settings';

import ThemeToggle from '../ThemeToggle';
import ThemeToggle from './ThemeToggle';

describe('ThemeToggle', () => {
const useSettingsSpy = vi.spyOn(UseSettings, 'useSettings');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render, screen } from 'test/test-utils';

import logo from 'assets/img/logo.png';

import Card from '../Card';
import Card from './Card';

describe('Card', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import MessageCard from '../MessageCard';
import MessageCard from './MessageCard';

describe('MessageCard', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render, screen } from 'test/test-utils';

import { donutChartDataFixture } from '__fixtures__/charts';

import DonutChart from '../DonutChart';
import DonutChart from './DonutChart';

describe('DonutChart', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import Columns from '../Columns';
import Columns from './Columns';

describe('Columns', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import Container from '../Container';
import Container from './Container';

describe('Container', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen } from 'test/test-utils';

import { describe, expect, it } from 'vitest';

import Page from '../Page';
import Page from './Page';

describe('Page', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen, waitFor } from 'test/test-utils';

import Dialog from '../Dialog';
import Dialog from './Dialog';

describe('Dialog', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import Divider from '../../Divider/Divider';
import Divider from './Divider';

describe('Divider', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';

import { render, screen, waitFor } from 'test/test-utils';

import DropdownMenu from '../DropdownMenu';
import DropdownMenu from './DropdownMenu';

describe('DropdownMenu', () => {
const mockClickFn = vi.fn();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest';
import { render, screen } from 'test/test-utils';

import ErrorBoundary from '../ErrorBoundary';
import ErrorBoundary from './ErrorBoundary';

describe('ErrorBoundary', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import ErrorFallback from '../ErrorFallback';
import ErrorFallback from './ErrorFallback';

describe('ErrorFallback', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import Footer from '../Footer';
import Footer from './Footer';

describe('Footer', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { z } from 'zod';

import { render, screen } from 'test/test-utils';

import Checkbox, { CheckboxProps } from '../Checkbox';
import Checkbox, { CheckboxProps } from './Checkbox';

const formSchema = z.object({
isEnabled: z.boolean().refine((val) => val === true, { message: 'Required' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import FieldError from '../FieldError';
import FieldError from './FieldError';

describe('FieldError', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { zodResolver } from '@hookform/resolvers/zod';

import { render, screen } from 'test/test-utils';

import Input, { InputProps } from '../Input';
import Input, { InputProps } from './Input';

const formSchema = z.object({
color: z.string().min(1, { message: 'Required' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import Label from '../Label';
import Label from './Label';

describe('Label', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useForm } from 'react-hook-form';

import { render, screen } from 'test/test-utils';

import RadioGroup, { RadioGroupProps } from '../RadioGroup';
import RadioGroup, { RadioGroupProps } from './RadioGroup';

const formSchema = z.object({
color: z.string().refine((val) => ['blue', 'red', 'yellow'].includes(val), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { describe, expect, it, vi } from 'vitest';
import { render, screen } from 'test/test-utils';
import userEvent from '@testing-library/user-event';

import SearchResult from '../SearchResult';
import SearchResult from './SearchResult';

import SearchInput from '../SearchInput';
import SearchInput from './SearchInput';

describe('SearchInput', () => {
const mockOnChange = vi.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest';
import { render, screen } from 'test/test-utils';
import userEvent from '@testing-library/user-event';

import SearchResult from '../SearchResult';
import SearchResult from './SearchResult';

describe('SearchResult', () => {
const mockOnClick = vi.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { zodResolver } from '@hookform/resolvers/zod';

import { render, screen, waitFor } from 'test/test-utils';

import Select, { SelectProps } from '../Select';
import Select, { SelectProps } from './Select';

const formSchema = z.object({
color: z.string().refine((val) => ['blue'].includes(val), { message: 'Must select blue.' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { zodResolver } from '@hookform/resolvers/zod';

import { render, screen } from 'test/test-utils';

import Textarea, { TextareaProps } from '../Textarea';
import Textarea, { TextareaProps } from './Textarea';

const formSchema = z.object({
myField: z.string().min(1, { message: 'Required' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import Toggle, { ToggleProps } from '../Toggle';
import Toggle, { ToggleProps } from './Toggle';

const formSchema = z.object({
myField: z.boolean().refine((val) => val === false, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as UseAuth from 'common/hooks/useAuth';
import * as UseGetCurrentUser from 'common/api/useGetCurrentUser';
import { userFixture1 } from '__fixtures__/users';

import AppMenu from '../AppMenu';
import AppMenu from './AppMenu';

describe('AppMenu', () => {
const useAuthSpy = vi.spyOn(UseAuth, 'useAuth');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { render, screen } from 'test/test-utils';

import * as UseAuth from 'common/hooks/useAuth';

import Header from '../Header';
import Header from './Header';

describe('Header', () => {
const useAuthSpy = vi.spyOn(UseAuth, 'useAuth');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import Avatar from '../Avatar';
import Avatar from './Avatar';

describe('Avatar', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen } from 'test/test-utils';

import FAIcon from '../FAIcon';
import FAIcon from './FAIcon';

describe('FAIcon', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import StandardLayout from '../StandardLayout';
import StandardLayout from './StandardLayout';

describe('StandardLayout', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import Link from '../Link';
import Link from './Link';

describe('Link', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';
const Text = lazy(() => import('common/components/Text/Text'));

import LoaderSuspense from '../LoaderSuspense';
import LoaderSuspense from './LoaderSuspense';

describe('LoaderSuspense', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';

import Skeleton from '../Skeleton';
import Skeleton from './Skeleton';

describe('Skeleton', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';

import { render, screen, waitFor } from 'test/test-utils';

import Spinner from '../Spinner';
import Spinner from './Spinner';

describe('Spinner', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { describe, expect, it } from 'vitest';
import { render, screen } from 'test/test-utils';
import userEvent from '@testing-library/user-event';

import SideMenu from '../SideMenu/SideMenu';
import SideMenu from './SideMenu/SideMenu';

import MenuButton from '../MenuButton';
import MenuButton from './MenuButton';

describe('MenuButton', () => {
it('should render successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest';
import { render, screen } from 'test/test-utils';
import userEvent from '@testing-library/user-event';

import MenuCloseButton from '../MenuCloseButton';
import MenuCloseButton from './MenuCloseButton';

describe('MenuCloseButton', () => {
it('should render successfully', async () => {
Expand Down
Loading