import { describe, it, expect } from '@jest/globals'; import { createOmdbProviderByApiKey } from './index'; describe('createOmdbProvider', () => { const client = createOmdbProviderByApiKey('68fd98ab'); it('returns correct data for tt10687116', async () => { const result = await client.getMetadata('tt10687116'); expect(result).toMatchObject({ actors: ['Kid Cudi', 'Jessica Williams', 'Laura Harrier'], awards: expect.any(String), contentRating: 'TV-MA', description: expect.any(String), directors: ['Fletcher Moules'], duration: 93, dvdReleaseDate: '30 Sep 2022', genres: ['Animation', 'Comedy', 'Music'], imdbId: 'tt10687116', posterUrl: expect.any(String), productionCountries: ['United Kingdom', 'United States'], productionYear: 2022, ratings: expect.arrayContaining([ { source: expect.any(String), value: expect.any(String), }, ]), releaseDate: '30 Sep 2022', title: 'Entergalactic', type: 'movie', writers: ['Kid Cudi', 'Kenya Barris', 'Ian Edelman'], }); }, 10_000); it('returns undefined for non-existent id', async () => { const result = await client.getMetadata('tt99999999999'); expect(result).toBeUndefined(); }, 10_000); });