All checks were successful
Tests / Backend - Tests skipped: 8, passed: 74
Backend Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 78.38% (551/703)
* Lines of Code: 703
#### Quality Gates Summary
No active quality gates.
Tests / Frontend - Lint, Tests et Build passed: 83
Frontend Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 84.94% (547/644)
* Lines of Code: 644
#### Quality Gates Summary
No active quality gates.
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good
44 lines
1.8 KiB
JavaScript
44 lines
1.8 KiB
JavaScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
import { screen } from '@testing-library/react'
|
|
import Accueil from '../../pages/Accueil'
|
|
import { getGameWindowApi } from '../../services/game'
|
|
import { renderWithProviders } from '../renderWithProviders'
|
|
|
|
vi.mock('../../services/game', () => ({
|
|
getGameWindowApi: vi.fn(),
|
|
}))
|
|
|
|
describe('Accueil - dates du jeu-concours', () => {
|
|
beforeEach(() => vi.clearAllMocks())
|
|
|
|
it("affiche les dates fixées dans le tableau de bord admin", async () => {
|
|
getGameWindowApi.mockResolvedValue({
|
|
configured: true,
|
|
phase: 'SCHEDULED',
|
|
startDate: '2026-11-14T23:00:00.000Z',
|
|
participationDeadline: '2026-12-14T23:00:00.000Z',
|
|
claimDeadline: '2027-01-13T23:00:00.000Z',
|
|
})
|
|
|
|
renderWithProviders(<Accueil />, { route: '/accueil' })
|
|
|
|
expect(await screen.findByText('Du 15 novembre au 14 décembre 2026')).toBeInTheDocument()
|
|
expect(screen.getByText(/ouverte du 15 novembre au 14 décembre 2026 inclus/)).toBeInTheDocument()
|
|
expect(screen.getByText(/retirer jusqu'au 13 janvier 2027/)).toBeInTheDocument()
|
|
await vi.waitFor(() => {
|
|
expect(document.title).toBe('Jeu-concours 100 % Gagnant du 15 novembre au 14 décembre | Thé Tip Top')
|
|
})
|
|
})
|
|
|
|
it("affiche les dates par défaut (2 → 31 octobre 2026) si l'API ne répond pas", async () => {
|
|
getGameWindowApi.mockRejectedValue(new Error('réseau'))
|
|
|
|
renderWithProviders(<Accueil />, { route: '/accueil' })
|
|
|
|
expect(screen.getByText('Du 02 au 31 octobre 2026')).toBeInTheDocument()
|
|
expect(screen.getByText(/retirer jusqu'au 30 novembre 2026/)).toBeInTheDocument()
|
|
await vi.waitFor(() => expect(getGameWindowApi).toHaveBeenCalled())
|
|
expect(screen.getByText('Du 02 au 31 octobre 2026')).toBeInTheDocument()
|
|
})
|
|
})
|