Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandes-natanael committed Sep 9, 2024
1 parent 012ec72 commit 3305ced
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
17 changes: 0 additions & 17 deletions test/app/studio/editJourney.form.test.tsx

This file was deleted.

27 changes: 1 addition & 26 deletions test/components/forms/trailsForms.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,9 @@ import '@testing-library/jest-dom';
import { useSession } from 'next-auth/react';
import { useQuery } from '@tanstack/react-query';
import { AppRouterContextProviderMock } from '../../context/app-router-context-mock';
import { Trail } from '@/lib/interfaces/trails.interface';
import { TrailForm } from '@/components/forms/trails.form';
import React from 'react';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { toast } from 'sonner';
import { createTrail, updateTrailById } from '@/services/studioMaker.service';
import { zodResolver } from '@hookform/resolvers/zod';


const MockData: Trail[] = [
{
_id: '1',
name: 'Trail 1',
journey: '1',
order: 1,
},
{
_id: '2',
name: 'Trail 2',
journey: '1',
order: 2,
},
];

import { render, screen } from '@testing-library/react';
jest.mock('next-auth/react', () => ({
useSession: jest.fn(),
}));
Expand All @@ -47,9 +26,6 @@ jest.mock('sonner', () => ({
}));


const mockCallback = jest.fn();
const mockSetDialog = jest.fn();

describe('Trail Form', () => {
beforeEach(() => {
(useSession as jest.Mock).mockReturnValue({ data: { user: { role: ['admin'] } } });
Expand All @@ -61,7 +37,6 @@ describe('Trail Form', () => {
render(
<AppRouterContextProviderMock router={{ push }}>
<TrailForm
trails={MockData}
journeyId={'1234'}
/>
</AppRouterContextProviderMock>
Expand Down

0 comments on commit 3305ced

Please sign in to comment.