From 45e5a586b755eeb755c714a17c77a02da3214842 Mon Sep 17 00:00:00 2001 From: Drikus Roor Date: Fri, 28 Jun 2024 14:49:53 +0200 Subject: [PATCH] fix(lint): Fix linting issues --- frontend/src/components/Final/Final.test.tsx | 14 +++++++------- frontend/src/components/Final/Final.tsx | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/Final/Final.test.tsx b/frontend/src/components/Final/Final.test.tsx index fb66c279e..3eff6a18c 100644 --- a/frontend/src/components/Final/Final.test.tsx +++ b/frontend/src/components/Final/Final.test.tsx @@ -52,8 +52,8 @@ describe('Final Component', () => { ); - expect(screen.queryByText(/Final Text/i)).to.exist; - expect(screen.queryByTestId('score')).to.exist; + expect(document.body.contains(screen.queryByText('Final Text'))).toBe(true); + expect(document.body.contains(screen.queryByTestId('score'))).toBe(true); }); it('calls onNext prop when button is clicked', async () => { @@ -85,8 +85,8 @@ describe('Final Component', () => { ); - expect(screen.queryByText('Rank')).to.not.exist; - expect(screen.queryByText('Social')).to.not.exist; + expect(document.body.contains(screen.queryByTestId('rank'))).toBe(false); + expect(document.body.contains(screen.queryByTestId('social'))).toBe(false); }); it('navigates to profile page when profile link is clicked', async () => { @@ -109,7 +109,7 @@ describe('Final Component', () => { const profileLink = screen.getByTestId('profile-link'); - expect(profileLink).to.exist; + expect(document.body.contains(profileLink)).toBe(true); expect(history.location.pathname).toBe('/'); @@ -145,7 +145,7 @@ describe('Final Component', () => { ); const el = screen.getByTestId('button-link'); - expect(el).to.exist; + expect(document.body.contains(el)).toBe(true); expect(el.getAttribute('href')).toBe('/redirect/aml'); }); @@ -159,7 +159,7 @@ describe('Final Component', () => { ); const el = screen.getByTestId('button-link'); - expect(el).to.exist; + expect(document.body.contains(el)).toBe(true); expect(el.getAttribute('href')).toBe('https://example.com'); }); diff --git a/frontend/src/components/Final/Final.tsx b/frontend/src/components/Final/Final.tsx index 8b5a3ed81..1f16f9894 100644 --- a/frontend/src/components/Final/Final.tsx +++ b/frontend/src/components/Final/Final.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useRef } from "react"; +import React, { useEffect } from "react"; import { withRouter } from "react-router-dom"; import Rank from "../Rank/Rank"; @@ -18,7 +18,6 @@ import FinalButton from "./FinalButton"; const Final = ({ block, participant, score, final_text, action_texts, button, onNext, history, show_participant_link, participant_id_only, show_profile_link, social, feedback_info, points, rank, logo }) => { - const [showScore, setShowScore] = useState(0); const session = useBoundStore((state) => state.session); useEffect(() => {