✅ test: fix failing unit tests
This commit is contained in:
+2
-9
@@ -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(<App />)
|
||||
|
||||
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()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -56,7 +56,7 @@ const IconWrapper: React.FC<IconWrapperProps> = ({ index, fontSize, Icon, sx, ..
|
||||
export const DescriptionIconLink = (props: IconLinkProps) => <IconWrapper aria-label="Doc-button" Icon={Description} {...props} />
|
||||
export const EmailIconLink = (props: IconLinkProps) => <IconWrapper aria-label="Email-button" Icon={Email} {...props} />
|
||||
export const InstagramIconLink = (props: IconLinkProps) => <IconWrapper aria-label="Instagram-button" Icon={Instagram} {...props} />
|
||||
export const FacebookIconLink = (props: IconLinkProps) => <IconWrapper aria-label="LinkedIn-button" Icon={Facebook} {...props} />
|
||||
export const FacebookIconLink = (props: IconLinkProps) => <IconWrapper aria-label="Facebook-button" Icon={Facebook} {...props} />
|
||||
export const AcademyIconLink = (props: IconLinkProps) => <IconWrapper aria-label="Academy-button" Icon={School} {...props} />
|
||||
export const VideoIconLink = (props: IconLinkProps) => <IconWrapper aria-label="Video-button" Icon={OndemandVideo} {...props} />
|
||||
export const ExternalIconLink = (props: IconLinkProps) => <IconWrapper aria-label="External-link-button" Icon={OpenInNew} {...props} />
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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<string, string> = {}
|
||||
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(<CookiePreferences />)
|
||||
|
||||
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(<CookiePreferences />)
|
||||
|
||||
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(<CookiePreferences />)
|
||||
|
||||
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(<CookiePreferences />)
|
||||
|
||||
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()
|
||||
})
|
||||
})
|
||||
@@ -11,7 +11,7 @@ const CookieConsent: React.FC<CookieConsentProps> = () => {
|
||||
return (
|
||||
<Box id="cookie-preferences" aria-labelledby="cookie-preferences-title" aria-describedby="cookie-preferences-description">
|
||||
<SectionHeader color="inherit" id="cookie-preferences-title" aria-label="cookie-preferences">
|
||||
Cookie policy
|
||||
Cookie Policy
|
||||
</SectionHeader>
|
||||
|
||||
<Typography component="p" color="textSecondary">
|
||||
|
||||
@@ -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(<Footer />)
|
||||
|
||||
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', () => {
|
||||
|
||||
@@ -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(
|
||||
<BrowserRouter>
|
||||
<PrivacyPolicy />
|
||||
</BrowserRouter>
|
||||
)
|
||||
render(<PrivacyPolicy />)
|
||||
expect(screen.getByText('Privacy Policy')).toBeInTheDocument()
|
||||
expect(screen.getByText('Google Analytics')).toBeInTheDocument()
|
||||
expect(screen.getByText('Your Rights')).toBeInTheDocument()
|
||||
expect(screen.getByText('Contact Us')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -12,8 +12,7 @@ const List = styled(MuiList)(({ theme }) => ({
|
||||
},
|
||||
}))
|
||||
|
||||
const PrivacyPolicy: React.FC = () => {
|
||||
return (
|
||||
const PrivacyPolicy = () => (
|
||||
<Box aria-labelledby="privacy-policy">
|
||||
<SectionHeader id="privacy-policy" aria-label="privacy-policy" color="inherit">
|
||||
Privacy Policy
|
||||
@@ -24,8 +23,8 @@ const PrivacyPolicy: React.FC = () => {
|
||||
|
||||
<SectionSubheader>Introduction</SectionSubheader>
|
||||
<Typography component="p" color="textSecondary">
|
||||
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.
|
||||
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.
|
||||
</Typography>
|
||||
|
||||
<SectionSubheader sx={{ mt: 4 }}>Titolare del trattamento</SectionSubheader>
|
||||
@@ -35,20 +34,20 @@ const PrivacyPolicy: React.FC = () => {
|
||||
|
||||
<SectionSubheader sx={{ mt: 4 }}> Responsabile Protezione Dati (DPO)</SectionSubheader>
|
||||
<Typography component="p" color="textSecondary">
|
||||
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.
|
||||
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.
|
||||
</Typography>
|
||||
|
||||
<SectionSubheader sx={{ mt: 4 }}>Tipi di dati trattati (Dati di navigazione)</SectionSubheader>
|
||||
<Typography component="p" color="textSecondary" gutterBottom>
|
||||
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.
|
||||
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.
|
||||
</Typography>
|
||||
<Typography component="p" color="textSecondary">
|
||||
I suddetti dati sono necessari per la fruizione della navigazione del sito. Questi dati vengono conservati dal provider per il tempo
|
||||
@@ -74,9 +73,7 @@ const PrivacyPolicy: React.FC = () => {
|
||||
<ListItemText>
|
||||
chiedere la cancellazione dei dati personali, salva l'esistenza di un diritto del Titolare alla conservazione degli stessi
|
||||
</ListItemText>
|
||||
<ListItemText>
|
||||
chiedere la comunicazione dei dati personali conservati eventualmente dal Titolare o la consegna di una loro copia;
|
||||
</ListItemText>
|
||||
<ListItemText>chiedere la comunicazione dei dati personali conservati eventualmente dal Titolare o la consegna di una loro copia;</ListItemText>
|
||||
<ListItemText>opporsi ad operazioni di trattamento che ritenga non siano legittime o chiedere limitazioni di trattamento</ListItemText>
|
||||
<ListItemText>
|
||||
Per l'esercizio dei suddetti diritti la legittimità della sua richiesta potrà essere valutata previa verifica della sua identità.
|
||||
@@ -93,6 +90,5 @@ const PrivacyPolicy: React.FC = () => {
|
||||
</Typography>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
export default PrivacyPolicy
|
||||
|
||||
@@ -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(<BusinessCardPage />)
|
||||
|
||||
// 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 () => {
|
||||
|
||||
@@ -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(<ContactPage />)
|
||||
|
||||
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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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(<MainPage />)
|
||||
|
||||
// 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)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -48,7 +48,7 @@ const MainPage = () => {
|
||||
</Typography>
|
||||
|
||||
<Typography variant="h4" pt={3}>
|
||||
Attività didattiche
|
||||
Attività Didattiche
|
||||
</Typography>
|
||||
<Typography pt={2}>
|
||||
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 = () => {
|
||||
</Typography>
|
||||
</ProjectSpotlight>
|
||||
{/* 3. Scuola d'arme */}
|
||||
<ProjectSpotlight ref={refTraining} anchor="bottom" image="images/battle.png" mobileImage="images/battle.png" title="Vita militare">
|
||||
<ProjectSpotlight ref={refTraining} anchor="bottom" image="images/battle.png" mobileImage="images/battle.png" title="Vita Militare">
|
||||
<Typography pt={1}>
|
||||
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,
|
||||
|
||||
@@ -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(<ProjectsPage />)
|
||||
|
||||
// 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()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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(<PrivacyPage />)
|
||||
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
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user