|
- import { describe, it, expect } from 'vitest'
-
- const response = await fetch('http://localhost:7777/api/explore')
- const data = await response.json()
-
- describe('test API explore', () => {
- it('should query correctly films', async () => {
- expect(response.status).toBe(200)
- expect(response.ok).toBe(true)
- })
- it('should get 20 films', async () => {
- expect(data.results.length).toBe(20)
- })
- it('should have correct data structure', async () => {
- // Vérification de la structure exacte
- expect(data.results[0]).toEqual(
- expect.objectContaining({
- adult: expect.any(Boolean),
- backdrop_path: expect.any(String),
- genre_ids: expect.any(Array),
- id: expect.any(Number),
- original_language: expect.any(String),
- original_title: expect.any(String),
- overview: expect.any(String),
- popularity: expect.any(Number),
- poster_path: expect.any(String),
- release_date: expect.any(String),
- title: expect.any(String),
- video: expect.any(Boolean),
- vote_average: expect.any(Number),
- vote_count: expect.any(Number)
- })
- )
- })
- })
|