Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sonar hotspots #44

Merged
merged 2 commits into from
Sep 9, 2024
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
1 change: 0 additions & 1 deletion src/components/home/StartPointsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const StartCard: React.FC<StartCardProps> = ({

const responsive = {
superLargeDesktop: {
// the naming can be any, depends on you.
breakpoint: { max: 4000, min: 3000 },
items: 5,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/trail-page/trailContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const TrailContents: React.FC<TrailContentProps> = ({
>
{contents.map((content, index) => {
const isClickable =
index <= contents.findIndex((c) => c._id === currentContentId); // Apenas as trilhas passadas e a atual são clicáveis
index <= contents.findIndex((c) => c._id === currentContentId);

return (
<Button
Expand Down
9 changes: 0 additions & 9 deletions src/services/studioMaker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ export const deleteStartPoint = async ({
export const getJourneys = async (): Promise<Journey[]> => {
try {
const response = await studioMakerApi.get('/journeys', {
// headers: {
// Authorization: `Bearer ${token}`,
// },
});
console.log('Journeys:', response.data);
return response.data;
Expand All @@ -120,9 +117,6 @@ export const getJourneys = async (): Promise<Journey[]> => {
export const getJourneysByPoint = async (id: string): Promise<Journey[]> => {
try {
const response = await studioMakerApi.get(`/journeys/point/${id}`, {
// headers: {
// Authorization: `Bearer ${token}`,
// },
});
console.log('Journeys:', response.data);
return response.data;
Expand Down Expand Up @@ -214,9 +208,6 @@ export const getTrails = async ({
console.log(id, token);
try {
const response = await studioMakerApi.get(`/trails/journey/${id}`, {
// headers: {
// Authorization: `Bearer ${token}`,
// },
});
console.log('Trails:', response.data);
return response.data;
Expand Down
31 changes: 31 additions & 0 deletions test/app/trail/trail.page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { render, screen } from '@testing-library/react';
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 ManageTrack from '@/app/trail/[...journeyId]/page';

jest.mock('next-auth/react', () => ({
useSession: jest.fn(),
}));

jest.mock('@tanstack/react-query', () => ({
useQuery: jest.fn(),
}));

describe('Trail List', () => {
beforeEach(() => {
(useSession as jest.Mock).mockReturnValue({ data: { user: { role: ['admin'] } } });
(useQuery as jest.Mock).mockReturnValue({ data: [], isLoading: false, error: null });
});

it('renders trailsList page', () => {
const push = jest.fn();
render(
<AppRouterContextProviderMock router={{ push }}>
<ManageTrack params={{ journeyId: '1' }} />
</AppRouterContextProviderMock>
);
expect(screen.getByText('Nova Trilha')).toBeInTheDocument();
});
});
Loading