From 527203c635f49cd5d806ab5972516797658b5181 Mon Sep 17 00:00:00 2001
From: m-tartari <37861893+m-tartari@users.noreply.github.com>
Date: Mon, 9 Feb 2026 16:16:29 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test:=20fix=20failing=20unit=20test?=
=?UTF-8?q?s?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/App.test.tsx | 11 +-
.../atoms/IconLinks/IconLinks.test.tsx | 4 +-
src/components/atoms/IconLinks/index.tsx | 2 +-
.../CookieConsent/CookieConsent.test.tsx | 2 -
.../CookiePreferences.test.tsx | 89 -----------
.../molecules/CookiePreferences/index.tsx | 2 +-
.../molecules/Footer/Footer.test.tsx | 12 +-
.../PrivacyPolicy/PrivacyPolicy.test.tsx | 11 +-
.../molecules/PrivacyPolicy/index.tsx | 146 +++++++++---------
.../BusinessCardPage.test.tsx | 24 ++-
.../pages/ContactPage/ContactPage.test.tsx | 9 +-
.../pages/ErrorPage/ErrorPage.test.tsx | 7 -
.../pages/MainPage/MainPage.test.tsx | 17 +-
src/components/pages/MainPage/MainPage.tsx | 4 +-
.../pages/PeoplePage/PeoplePage.test.tsx | 19 +--
.../pages/PrivacyPage/PrivacyPage.test.tsx | 16 +-
src/components/templates/Page/Page.test.tsx | 9 +-
17 files changed, 104 insertions(+), 280 deletions(-)
delete mode 100644 src/components/molecules/CookiePreferences/CookiePreferences.test.tsx
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 2710b73..0ae3b8b 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,20 +1,13 @@
import { render, screen } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
-import App from './App'
-
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() }, page: vi.fn() }),
-}))
+import App from './App.js'
describe('App component', () => {
test('renders MainPage without crashing', async () => {
render()
expect(screen.getByLabelText('loading-screen')).toBeInTheDocument()
- expect(await screen.findByText('Robotics Engineer')).toBeInTheDocument()
+ expect(await screen.findByText("Compagnia d'Arme del Santo Luca")).toBeInTheDocument()
expect(screen.queryByLabelText('loading-screen')).not.toBeInTheDocument()
})
})
diff --git a/src/components/atoms/IconLinks/IconLinks.test.tsx b/src/components/atoms/IconLinks/IconLinks.test.tsx
index efef427..bbaeee2 100644
--- a/src/components/atoms/IconLinks/IconLinks.test.tsx
+++ b/src/components/atoms/IconLinks/IconLinks.test.tsx
@@ -7,8 +7,8 @@ import * as IconLinks from './index.js'
const labels: { [key: string]: string } = {
DescriptionIconLink: 'Doc-button',
EmailIconLink: 'Email-button',
- GitHubIconLink: 'GitHub-button',
- LinkedInIconLink: 'LinkedIn-button',
+ InstagramIconLink: 'Instagram-button',
+ FacebookIconLink: 'Facebook-button',
AcademyIconLink: 'Academy-button',
VideoIconLink: 'Video-button',
ExternalIconLink: 'External-link-button',
diff --git a/src/components/atoms/IconLinks/index.tsx b/src/components/atoms/IconLinks/index.tsx
index 8cad0f6..e59f59b 100644
--- a/src/components/atoms/IconLinks/index.tsx
+++ b/src/components/atoms/IconLinks/index.tsx
@@ -56,7 +56,7 @@ const IconWrapper: React.FC = ({ index, fontSize, Icon, sx, ..
export const DescriptionIconLink = (props: IconLinkProps) =>
export const EmailIconLink = (props: IconLinkProps) =>
export const InstagramIconLink = (props: IconLinkProps) =>
-export const FacebookIconLink = (props: IconLinkProps) =>
+export const FacebookIconLink = (props: IconLinkProps) =>
export const AcademyIconLink = (props: IconLinkProps) =>
export const VideoIconLink = (props: IconLinkProps) =>
export const ExternalIconLink = (props: IconLinkProps) =>
diff --git a/src/components/molecules/CookieConsent/CookieConsent.test.tsx b/src/components/molecules/CookieConsent/CookieConsent.test.tsx
index 42e707c..e5e2ac9 100644
--- a/src/components/molecules/CookieConsent/CookieConsent.test.tsx
+++ b/src/components/molecules/CookieConsent/CookieConsent.test.tsx
@@ -1,6 +1,4 @@
import { render, screen, fireEvent } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import CookieConsent from './index.js'
diff --git a/src/components/molecules/CookiePreferences/CookiePreferences.test.tsx b/src/components/molecules/CookiePreferences/CookiePreferences.test.tsx
deleted file mode 100644
index ef3115b..0000000
--- a/src/components/molecules/CookiePreferences/CookiePreferences.test.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { screen, fireEvent } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
-
-import { renderWithRouter as render } from 'components/utils/tests/index.js'
-
-import CookiePreferences from './index.js'
-
-// Mock the analytics module
-const analytics = { plugins: { enable: vi.fn(), disable: vi.fn() } }
-vi.mock('use-analytics', () => ({
- useAnalytics: () => analytics,
-}))
-
-// Mock localStorage
-const localStorageMock = (() => {
- let store: Record = {}
- return {
- getItem: vi.fn((key: string) => store[key] || null),
- setItem: vi.fn((key: string, value: string) => {
- store[key] = value
- }),
- clear: vi.fn(() => {
- store = {}
- }),
- }
-})()
-
-Object.defineProperty(window, 'localStorage', { value: localStorageMock })
-
-describe('CookiePreferences', () => {
- beforeEach(() => {
- vi.clearAllMocks()
- localStorageMock.clear()
- })
-
- it('accepts all cookies when clicking Accept All', () => {
- render()
-
- expect(screen.getByText('Cookie Preferences')).toBeInTheDocument()
-
- fireEvent.click(screen.getByText('Accept All'))
- fireEvent.click(screen.getByText('Save Preferences'))
-
- expect(localStorageMock.setItem).toHaveBeenCalledWith('m-tartari-cookie-consent', JSON.stringify({ necessary: true, analytics: true }))
- expect(analytics.plugins.disable).not.toHaveBeenCalled()
- expect(analytics.plugins.enable).toHaveBeenCalled()
- })
-
- it('rejects analytics cookies when clicking Reject All', () => {
- render()
-
- expect(screen.getByText('Cookie Preferences')).toBeInTheDocument()
-
- fireEvent.click(screen.getByText('Reject All'))
- fireEvent.click(screen.getByText('Save Preferences'))
-
- expect(localStorageMock.setItem).toHaveBeenCalledWith('m-tartari-cookie-consent', JSON.stringify({ necessary: true, analytics: false }))
- expect(analytics.plugins.enable).not.toHaveBeenCalled()
- expect(analytics.plugins.disable).toHaveBeenCalled()
- })
-
- it('toggles analytics cookies when clicking the Analytics button', () => {
- render()
-
- expect(screen.getByText('Cookie Preferences')).toBeInTheDocument()
-
- fireEvent.click(screen.getByLabelText('analytics-cookies-toggle'))
- fireEvent.click(screen.getByText('Save Preferences'))
-
- expect(localStorageMock.setItem).toHaveBeenCalledWith('m-tartari-cookie-consent', JSON.stringify({ necessary: true, analytics: true }))
- expect(analytics.plugins.disable).not.toHaveBeenCalled()
- expect(analytics.plugins.enable).toHaveBeenCalled()
- })
-
- it('renders the cookie consent in the right state when consent in local storage', () => {
- localStorageMock.getItem.mockReturnValueOnce(JSON.stringify({ necessary: true, analytics: true }))
- render()
-
- expect(screen.getByText('Cookie Preferences')).toBeInTheDocument()
-
- fireEvent.click(screen.getByLabelText('analytics-cookies-toggle'))
- fireEvent.click(screen.getByText('Save Preferences'))
-
- expect(localStorageMock.setItem).toHaveBeenCalledWith('m-tartari-cookie-consent', JSON.stringify({ necessary: true, analytics: false }))
- expect(analytics.plugins.enable).not.toHaveBeenCalled()
- expect(analytics.plugins.disable).toHaveBeenCalled()
- })
-})
diff --git a/src/components/molecules/CookiePreferences/index.tsx b/src/components/molecules/CookiePreferences/index.tsx
index ea9cdba..840cd42 100644
--- a/src/components/molecules/CookiePreferences/index.tsx
+++ b/src/components/molecules/CookiePreferences/index.tsx
@@ -11,7 +11,7 @@ const CookieConsent: React.FC = () => {
return (
- Cookie policy
+ Cookie Policy
diff --git a/src/components/molecules/Footer/Footer.test.tsx b/src/components/molecules/Footer/Footer.test.tsx
index ac1656a..1d40a27 100644
--- a/src/components/molecules/Footer/Footer.test.tsx
+++ b/src/components/molecules/Footer/Footer.test.tsx
@@ -1,24 +1,16 @@
import React from 'react'
import { screen } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import { renderWithRouter as render } from 'components/utils/tests/index.js'
import Footer from './index.js'
-// Mock the analytics module
-const analytics = { plugins: { enable: vi.fn(), disable: vi.fn() } }
-vi.mock('use-analytics', () => ({
- useAnalytics: () => analytics,
-}))
-
describe('Footer', () => {
it('renders the Footer', async () => {
render()
- expect(screen.getAllByText('Privacy Policy')).toHaveLength(2) // link and dialog
- expect(screen.getAllByText('Cookie Preferences')).toHaveLength(2) // link and dialog
+ expect(screen.getAllByText('Privacy Policy')).toHaveLength(1) // link and dialog
+ expect(screen.getAllByText('Cookie Preferences')).toHaveLength(1) // link only
})
it('does not show the dialog if the `showCookieConsent` prop is false', () => {
diff --git a/src/components/molecules/PrivacyPolicy/PrivacyPolicy.test.tsx b/src/components/molecules/PrivacyPolicy/PrivacyPolicy.test.tsx
index 0f434c9..646b773 100644
--- a/src/components/molecules/PrivacyPolicy/PrivacyPolicy.test.tsx
+++ b/src/components/molecules/PrivacyPolicy/PrivacyPolicy.test.tsx
@@ -1,19 +1,10 @@
-import React from 'react'
import { render, screen } from '@testing-library/react'
-import { BrowserRouter } from 'react-router-dom'
import PrivacyPolicy from './index.js'
describe('Privacy Policy', () => {
it('renders the Privacy Policy page', async () => {
- render(
-
-
-
- )
+ render()
expect(screen.getByText('Privacy Policy')).toBeInTheDocument()
- expect(screen.getByText('Google Analytics')).toBeInTheDocument()
- expect(screen.getByText('Your Rights')).toBeInTheDocument()
- expect(screen.getByText('Contact Us')).toBeInTheDocument()
})
})
diff --git a/src/components/molecules/PrivacyPolicy/index.tsx b/src/components/molecules/PrivacyPolicy/index.tsx
index 6f9942a..0c40495 100644
--- a/src/components/molecules/PrivacyPolicy/index.tsx
+++ b/src/components/molecules/PrivacyPolicy/index.tsx
@@ -12,87 +12,83 @@ const List = styled(MuiList)(({ theme }) => ({
},
}))
-const PrivacyPolicy: React.FC = () => {
- return (
-
-
- Privacy Policy
-
-
- Data ultimo aggiornamento: Feb. 1, 2026
-
+const PrivacyPolicy = () => (
+
+
+ Privacy Policy
+
+
+ Data ultimo aggiornamento: Feb. 1, 2026
+
- Introduction
-
- L'informativa è resa solo per il sito web ufficiale di la Compagnia d'Arme del Santo Luca all'indirizzo https://{window.location.host} e non
- per altri siti web esterni, eventualmente consultati dall'utente tramite link.
-
+ Introduction
+
+ L'informativa è resa solo per il sito web ufficiale di la Compagnia d'Arme del Santo Luca all'indirizzo https://{window.location.host} e non per
+ altri siti web esterni, eventualmente consultati dall'utente tramite link.
+
- Titolare del trattamento
-
- Il Titolare del trattamento è la Compagnia d'Arme del Santo Luca, con sede legale in via Leonello Poletti n. 16, 44122 Ferrara.
-
+ Titolare del trattamento
+
+ Il Titolare del trattamento è la Compagnia d'Arme del Santo Luca, con sede legale in via Leonello Poletti n. 16, 44122 Ferrara.
+
- Responsabile Protezione Dati (DPO)
-
- Il Titolare, la Compagnia d'Arme del Santo Luca ente di diritto privato senza fine di lucro, ai sensi dell'art. 37 GDPR, non è tenuto a
- nominare il Responsabile della protezione dei dati.
-
+ Responsabile Protezione Dati (DPO)
+
+ Il Titolare, la Compagnia d'Arme del Santo Luca ente di diritto privato senza fine di lucro, ai sensi dell'art. 37 GDPR, non è tenuto a nominare
+ il Responsabile della protezione dei dati.
+
- Tipi di dati trattati (Dati di navigazione)
-
- I sistemi informatici e le procedure software preposte al funzionamento di questo sito web acquisiscono, nel corso del loro normale esercizio,
- alcuni dati personali la cui trasmissione è implicita nell'uso dei protocolli di comunicazione di Internet. Si tratta di informazioni che non
- sono raccolte per essere associate a interessati identificati, ma che per loro stessa natura potrebbero, attraverso elaborazioni ed
- associazioni con dati detenuti da terzi, permettere di identificare gli utenti. In questa categoria di dati rientrano gli indirizzi IP o i
- nomi a dominio dei computer utilizzati dagli utenti che si connettono al sito, gli indirizzi in notazione URI (Uniform Resource Identifier)
- delle risorse richieste, l'orario della richiesta, il metodo utilizzato nel sottoporre la richiesta al server, la dimensione del file ottenuto
- in risposta, il codice numerico indicante lo stato della risposta data dal server (buon fine, errore, ecc.) ed altri parametri relativi al
- sistema operativo e all'ambiente informatico dell'utente.
-
-
- I suddetti dati sono necessari per la fruizione della navigazione del sito. Questi dati vengono conservati dal provider per il tempo
- strettamente necessario. I dati potrebbero essere utilizzati per l'accertamento di responsabilità in caso di ipotetici reati informatici ai
- danni del sito.
-
+ Tipi di dati trattati (Dati di navigazione)
+
+ I sistemi informatici e le procedure software preposte al funzionamento di questo sito web acquisiscono, nel corso del loro normale esercizio,
+ alcuni dati personali la cui trasmissione è implicita nell'uso dei protocolli di comunicazione di Internet. Si tratta di informazioni che non
+ sono raccolte per essere associate a interessati identificati, ma che per loro stessa natura potrebbero, attraverso elaborazioni ed associazioni
+ con dati detenuti da terzi, permettere di identificare gli utenti. In questa categoria di dati rientrano gli indirizzi IP o i nomi a dominio dei
+ computer utilizzati dagli utenti che si connettono al sito, gli indirizzi in notazione URI (Uniform Resource Identifier) delle risorse
+ richieste, l'orario della richiesta, il metodo utilizzato nel sottoporre la richiesta al server, la dimensione del file ottenuto in risposta, il
+ codice numerico indicante lo stato della risposta data dal server (buon fine, errore, ecc.) ed altri parametri relativi al sistema operativo e
+ all'ambiente informatico dell'utente.
+
+
+ I suddetti dati sono necessari per la fruizione della navigazione del sito. Questi dati vengono conservati dal provider per il tempo
+ strettamente necessario. I dati potrebbero essere utilizzati per l'accertamento di responsabilità in caso di ipotetici reati informatici ai
+ danni del sito.
+
- Modalità del trattamento
-
- I dati personali di navigazione sono trattati con strumenti automatizzati per il tempo strettamente necessario a conseguire gli scopi per cui
- sono stati raccolti. I dati personali di contatto sono trattati con strumenti cartacei e informatici e vengono conservati fino a completa
- esecuzione del rapporto precontrattuale e di quello contrattuale o per quanto necessario secondo termini di legge. Specifiche misure di
- sicurezza sono osservate per prevenire la perdita dei dati, usi illeciti o non corretti ed accessi non autorizzati.
-
+ Modalità del trattamento
+
+ I dati personali di navigazione sono trattati con strumenti automatizzati per il tempo strettamente necessario a conseguire gli scopi per cui
+ sono stati raccolti. I dati personali di contatto sono trattati con strumenti cartacei e informatici e vengono conservati fino a completa
+ esecuzione del rapporto precontrattuale e di quello contrattuale o per quanto necessario secondo termini di legge. Specifiche misure di
+ sicurezza sono osservate per prevenire la perdita dei dati, usi illeciti o non corretti ed accessi non autorizzati.
+
- Diritti di accesso e reclamo
-
- Scrivendo attraverso il modulo di contatto le è garantito il diritto di:
-
-
- chiedere l'esistenza e l'accesso ai dati che la riguardano;
- chiedere l'aggiornamento e l'integrazione dei dati forniti;
-
- chiedere la cancellazione dei dati personali, salva l'esistenza di un diritto del Titolare alla conservazione degli stessi
-
-
- chiedere la comunicazione dei dati personali conservati eventualmente dal Titolare o la consegna di una loro copia;
-
- opporsi ad operazioni di trattamento che ritenga non siano legittime o chiedere limitazioni di trattamento
-
- Per l'esercizio dei suddetti diritti la legittimità della sua richiesta potrà essere valutata previa verifica della sua identità.
-
-
+ Diritti di accesso e reclamo
+
+ Scrivendo attraverso il modulo di contatto le è garantito il diritto di:
+
+
+ chiedere l'esistenza e l'accesso ai dati che la riguardano;
+ chiedere l'aggiornamento e l'integrazione dei dati forniti;
+
+ chiedere la cancellazione dei dati personali, salva l'esistenza di un diritto del Titolare alla conservazione degli stessi
+
+ chiedere la comunicazione dei dati personali conservati eventualmente dal Titolare o la consegna di una loro copia;
+ opporsi ad operazioni di trattamento che ritenga non siano legittime o chiedere limitazioni di trattamento
+
+ Per l'esercizio dei suddetti diritti la legittimità della sua richiesta potrà essere valutata previa verifica della sua identità.
+
+
-
- Qualora ritenga che il trattamento abbia violato un suo diritto potrà presentare obiezioni nei confronti del Titolare utilizzando l'indirizzo
- sopra indicato e anche presentando reclamo presso l'Autorità Garante{' '}
-
- www.garanteprivacy.it
-
- .
-
-
- )
-}
+
+ Qualora ritenga che il trattamento abbia violato un suo diritto potrà presentare obiezioni nei confronti del Titolare utilizzando l'indirizzo
+ sopra indicato e anche presentando reclamo presso l'Autorità Garante{' '}
+
+ www.garanteprivacy.it
+
+ .
+
+
+)
export default PrivacyPolicy
diff --git a/src/components/pages/BusinessCardPage/BusinessCardPage.test.tsx b/src/components/pages/BusinessCardPage/BusinessCardPage.test.tsx
index f95892a..c5c1c79 100644
--- a/src/components/pages/BusinessCardPage/BusinessCardPage.test.tsx
+++ b/src/components/pages/BusinessCardPage/BusinessCardPage.test.tsx
@@ -1,7 +1,5 @@
import { screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import { renderWithRouter as render } from 'components/utils/tests/index.js'
import BusinessCardPage from './index.js'
@@ -13,17 +11,13 @@ vi.mock('./envVars.js', () => ({
PHONE: '+123456789',
EMAIL: 'test@example.com',
FACEBOOK: 'testfacebook',
+ INSTAGRAM: 'testinstagram',
}))
// Mock window.print
const mockPrint = vi.fn()
window.print = mockPrint
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() } }),
-}))
-
describe('BusinessCardPage', () => {
beforeEach(() => {
mockPrint.mockClear()
@@ -33,15 +27,15 @@ describe('BusinessCardPage', () => {
render()
// Name appears in uppercase in the first card
- expect(screen.getAllByText('Test Name')).toHaveLength(2)
+ expect(screen.getByText('Test Name')).toBeInTheDocument()
expect(screen.getByText('Test Position')).toBeInTheDocument()
// Check if values are rendered correctly in the second card
- expect(screen.getByText('Test VAT')).toBeInTheDocument()
expect(screen.getByText('+123456789')).toBeInTheDocument()
expect(screen.getByText('test@example.com')).toBeInTheDocument()
- expect(screen.getByText('www.m-tartari.eu')).toBeInTheDocument()
- expect(screen.getByText('testlinkedin')).toBeInTheDocument()
+ expect(screen.getByText('www.compagniadarmedelsantoluca.it')).toBeInTheDocument()
+ expect(screen.getByText('@testinstagram')).toBeInTheDocument()
+ expect(screen.getByText('@testfacebook')).toBeInTheDocument()
})
it('has correct links with proper href attributes', () => {
@@ -56,12 +50,12 @@ describe('BusinessCardPage', () => {
expect(emailLink).toHaveAttribute('href', 'mailto:test@example.com')
// Check website link
- const websiteLink = screen.getByText('www.m-tartari.eu').closest('a')
- expect(websiteLink).toHaveAttribute('href', 'https://www.m-tartari.eu')
+ const websiteLink = screen.getByText('www.compagniadarmedelsantoluca.it').closest('a')
+ expect(websiteLink).toHaveAttribute('href', 'https://www.compagniadarmedelsantoluca.it/')
// Check Facebook Link
- const linkedinLink = screen.getByText('testlinkedin').closest('a')
- expect(linkedinLink).toHaveAttribute('href', 'https://www.linkedin.com/in/testlinkedin/')
+ const linkedinLink = screen.getByText('@testfacebook').closest('a')
+ expect(linkedinLink).toHaveAttribute('href', 'https://facebook.com/testfacebook/')
})
it('calls window.print when print button is clicked', async () => {
diff --git a/src/components/pages/ContactPage/ContactPage.test.tsx b/src/components/pages/ContactPage/ContactPage.test.tsx
index 76a1e7f..4b6e517 100644
--- a/src/components/pages/ContactPage/ContactPage.test.tsx
+++ b/src/components/pages/ContactPage/ContactPage.test.tsx
@@ -1,21 +1,14 @@
import { screen } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import { renderWithRouter as render } from 'components/utils/tests/index.js'
import ContactPage from './index.js'
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() } }),
-}))
-
vi.stubGlobal('open', vi.fn())
describe('ContactPage', () => {
test('renders without crashing and displays the correct contact methods', () => {
render()
- expect(screen.getAllByText('Contacts')).toHaveLength(2) // Page title and the Appbar drawer link
+ expect(screen.getAllByText('Contatti')).toHaveLength(2) // Page title and the Appbar drawer link
expect(screen.getByLabelText('Email link')).toBeInTheDocument()
expect(screen.getByLabelText('Facebook Link')).toBeInTheDocument()
expect(screen.getByLabelText('Instagram link')).toBeInTheDocument()
diff --git a/src/components/pages/ErrorPage/ErrorPage.test.tsx b/src/components/pages/ErrorPage/ErrorPage.test.tsx
index b4825b1..f281309 100644
--- a/src/components/pages/ErrorPage/ErrorPage.test.tsx
+++ b/src/components/pages/ErrorPage/ErrorPage.test.tsx
@@ -1,15 +1,8 @@
import { screen, render } from '@testing-library/react'
import { RouterProvider, createMemoryRouter } from 'react-router-dom'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import ErrorPage from './index.js'
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() } }),
-}))
-
// Suppress console.error messages during tests
const originalConsoleError = console.error
console.error = vi.fn()
diff --git a/src/components/pages/MainPage/MainPage.test.tsx b/src/components/pages/MainPage/MainPage.test.tsx
index 89cd7d1..2e7447a 100644
--- a/src/components/pages/MainPage/MainPage.test.tsx
+++ b/src/components/pages/MainPage/MainPage.test.tsx
@@ -1,27 +1,20 @@
import { screen } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import { renderWithRouter as render } from 'components/utils/tests/index.js'
import MainPage from '.'
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() } }),
-}))
-
// Tests
describe('Main page', () => {
it('Should render the page correctly on desktop', async () => {
await render()
// Make sure the page title is correct
- expect(screen.getByText('Robotics Engineer')).toBeInTheDocument()
+ expect(await screen.findByText("Compagnia d'Arme del Santo Luca")).toBeInTheDocument()
// Make sure the project spotlights are present for both desktop and mobile
- expect(screen.getAllByText('LINFA: An Intuitive Block-Programming Interface for Reconfigurable Robots')).toHaveLength(2)
- expect(screen.getAllByText("Revamping HHCM's Modular: Swift Generation of Modular Robot Models")).toHaveLength(2)
- expect(screen.getAllByText('Automated Actuators and Robotic Modules Calibration')).toHaveLength(2)
- expect(screen.getAllByText('Voice Controlled Mobile Robot for Indoor Applications')).toHaveLength(2)
+ expect(screen.getAllByText('Chi Siamo')).toHaveLength(2)
+ expect(screen.getAllByText('Vita Civile')).toHaveLength(2)
+ expect(screen.getAllByText('Attività Didattiche')).toHaveLength(2)
+ expect(screen.getAllByText('Vita Militare')).toHaveLength(2)
})
})
diff --git a/src/components/pages/MainPage/MainPage.tsx b/src/components/pages/MainPage/MainPage.tsx
index e6ef2f9..dfd0e73 100644
--- a/src/components/pages/MainPage/MainPage.tsx
+++ b/src/components/pages/MainPage/MainPage.tsx
@@ -48,7 +48,7 @@ const MainPage = () => {
- Attività didattiche
+ Attività Didattiche
La Compagnia propone percorsi didattici dedicati alla scoperta della vita nel Basso Medioevo, illustrando le attività svolte all'interno
@@ -57,7 +57,7 @@ const MainPage = () => {
{/* 3. Scuola d'arme */}
-
+
La dimensione militare è il cuore operativo della Compagnia, che è in grado di allestire un campo d'arme del Basso Medioevo con tende
storiche finemente arredate, armamenti e dotazioni coerenti con il periodo rievocato. All'interno del campo vengono mostrate le gerarchie,
diff --git a/src/components/pages/PeoplePage/PeoplePage.test.tsx b/src/components/pages/PeoplePage/PeoplePage.test.tsx
index 02dc6b8..76c8660 100644
--- a/src/components/pages/PeoplePage/PeoplePage.test.tsx
+++ b/src/components/pages/PeoplePage/PeoplePage.test.tsx
@@ -1,28 +1,15 @@
import { screen } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import { renderWithRouter as render } from 'components/utils/tests/index.js'
import ProjectsPage from '.'
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() } }),
-}))
-
vi.stubGlobal('open', vi.fn())
-describe('ProjectsPage component', () => {
+describe('PeoplePage component', () => {
test('renders without crashing and displays the correct project titles', () => {
render()
// check the section titles
- expect(screen.getByText('Robotics')).toBeInTheDocument()
- expect(screen.getByText('Engineering')).toBeInTheDocument()
- expect(screen.getByText('Hobbies')).toBeInTheDocument()
-
- // check some of the projects
- expect(screen.getByText('LINFA: An Intuitive Block-Programming Interface for Reconfigurable Robots')).toBeInTheDocument()
- expect(screen.getByText("Revamping HHCM's Modular: Swift Generation and Control of Modular Robot Models")).toBeInTheDocument()
- expect(screen.getByText("Scuola d'arme")).toBeInTheDocument()
+ expect(screen.getByText('Ferantino di Zampalocha')).toBeInTheDocument()
+ expect(screen.getByText('Galacino Galaci')).toBeInTheDocument()
})
})
diff --git a/src/components/pages/PrivacyPage/PrivacyPage.test.tsx b/src/components/pages/PrivacyPage/PrivacyPage.test.tsx
index 13e46d9..4901322 100644
--- a/src/components/pages/PrivacyPage/PrivacyPage.test.tsx
+++ b/src/components/pages/PrivacyPage/PrivacyPage.test.tsx
@@ -1,24 +1,14 @@
-import React from 'react'
import { screen } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import { renderWithRouter as render } from 'components/utils/tests/index.js'
import PrivacyPage from './index.js'
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() } }),
-}))
-
describe('PrivacyPage', () => {
it('renders the Privacy Policy page', () => {
render()
- expect(screen.getAllByText('Privacy Policy')).toHaveLength(3) // title, body (cookie preferences section) and footer
- expect(screen.getByText('Google Analytics')).toBeInTheDocument()
- expect(screen.getByText('Your Rights')).toBeInTheDocument()
- expect(screen.getByText('Contact Us')).toBeInTheDocument()
- expect(screen.getAllByText('Cookie Preferences')).toHaveLength(2) // body and footer
+ expect(screen.getAllByText('Privacy Policy')).toHaveLength(2) // title and footer
+ expect(screen.getAllByText('Cookie Policy')).toHaveLength(1) // body
+ expect(screen.getAllByText('Cookie Preferences')).toHaveLength(1) // footer
})
})
diff --git a/src/components/templates/Page/Page.test.tsx b/src/components/templates/Page/Page.test.tsx
index 0e108ed..0b8f433 100644
--- a/src/components/templates/Page/Page.test.tsx
+++ b/src/components/templates/Page/Page.test.tsx
@@ -1,14 +1,7 @@
import { screen } from '@testing-library/react'
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { useAnalytics } from 'use-analytics'
import { renderWithRouter as render } from 'components/utils/tests/index.js'
-import Page from '.'
-
-// Mock the analytics module
-vi.mock('use-analytics', () => ({
- useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() } }),
-}))
+import Page from './index.js'
describe('Page component', () => {
const defaultProps = {