Skip to content

Commit

Permalink
Merge pull request #44 from fga-eps-mds/fix-sonar-hotspots
Browse files Browse the repository at this point in the history
Fix sonar hotspots
  • Loading branch information
fernandes-natanael authored Sep 9, 2024
2 parents 84c1514 + 56e56bc commit 5dea10f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
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();
});
});

0 comments on commit 5dea10f

Please sign in to comment.