31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { render, screen } from '@testing-library/react'
|
|
import Footer from '@/components/brand/Footer'
|
|
|
|
// The production CSP is `img-src 'self' data: blob:` (DEPLOY.md): every
|
|
// footer image must be served by the application itself (R4.10j, the
|
|
// ZenQuality logo was hotlinked from zenquality.fr and refused).
|
|
describe('Footer', () => {
|
|
it('serves every image from the application, never an external host', () => {
|
|
render(<Footer />)
|
|
const sources = screen.getAllByRole('img').map((img) => img.getAttribute('src'))
|
|
expect(sources).toHaveLength(2)
|
|
for (const src of sources) {
|
|
expect(src).toMatch(/^\/(?!\/)|^data:|^blob:/)
|
|
expect(src).not.toMatch(/^https?:/)
|
|
}
|
|
})
|
|
|
|
it('keeps the credit links', () => {
|
|
render(<Footer />)
|
|
expect(screen.getByRole('link', { name: 'ZenQuality' })).toHaveAttribute(
|
|
'href',
|
|
'https://zenquality.fr',
|
|
)
|
|
expect(screen.getByRole('link', { name: 'Paws in Harmony' })).toHaveAttribute(
|
|
'href',
|
|
'https://www.instagram.com/paws.iin.harmony',
|
|
)
|
|
})
|
|
})
|