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.
42 lines
1.7 KiB
42 lines
1.7 KiB
11 months ago
|
import { describe, it, expect } from '@jest/globals';
|
||
|
|
||
11 months ago
|
import { createOmdbApiClient } from '../src/integration/movies/omdb/apiClient';
|
||
11 months ago
|
|
||
11 months ago
|
describe('createOmdbApiClient', () => {
|
||
|
const client = createOmdbApiClient('68fd98ab');
|
||
11 months ago
|
it('returns some data for tt11873472', async () => {
|
||
11 months ago
|
const result = await client.fetchMetadata('tt11873472');
|
||
11 months ago
|
expect(result).toMatchObject({
|
||
11 months ago
|
Actors: 'Cheryl Isheja, Elvis Ngabo, Diogène Ntarindwa',
|
||
|
Awards: expect.any(String),
|
||
|
BoxOffice: expect.any(String),
|
||
|
Country: 'Rwanda, France, Canada, United Kingdom, United States',
|
||
|
DVD: expect.any(String),
|
||
|
Director: 'Anisia Uzeyman, Saul Williams',
|
||
|
Genre: 'Musical, Sci-Fi',
|
||
|
Language: 'Kinyarwanda, Kirundi, Swahili, French, English',
|
||
|
Metascore: expect.stringMatching(/^\d+$/),
|
||
|
Plot: expect.any(String),
|
||
|
Poster: expect.stringMatching(/^http/),
|
||
|
Production: expect.any(String),
|
||
|
Rated: expect.any(String),
|
||
|
Ratings: expect.any(Array),
|
||
|
Released: '10 May 2023',
|
||
|
Runtime: '105 min',
|
||
|
Title: 'Neptune Frost',
|
||
|
Type: 'movie',
|
||
|
Website: expect.any(String),
|
||
|
Writer: 'Saul Williams',
|
||
|
Year: '2021',
|
||
|
imdbID: 'tt11873472',
|
||
|
imdbRating: expect.stringMatching(/^\d?\d(\.\d)?$/),
|
||
|
imdbVotes: expect.stringMatching(/^\d+$/),
|
||
11 months ago
|
});
|
||
|
}, 10_000);
|
||
11 months ago
|
|
||
11 months ago
|
it('returns undefined for non-existent id', async () => {
|
||
11 months ago
|
const result = await client.fetchMetadata('tt99999999999');
|
||
11 months ago
|
expect(result).toBeUndefined();
|
||
|
}, 10_000);
|
||
11 months ago
|
});
|