You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
40 lines
1.5 KiB
11 months ago
|
import { describe, it, expect } from '@jest/globals';
|
||
|
|
||
11 months ago
|
import { createOmdbProviderByApiKey } from '../src/integration/movies/omdb';
|
||
11 months ago
|
|
||
|
describe('createOmdbProvider', () => {
|
||
11 months ago
|
const client = createOmdbProviderByApiKey('68fd98ab');
|
||
11 months ago
|
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);
|
||
|
|
||
11 months ago
|
it('returns undefined for non-existent id', async () => {
|
||
11 months ago
|
const result = await client.getMetadata('tt99999999999');
|
||
|
expect(result).toBeUndefined();
|
||
|
}, 10_000);
|
||
|
});
|