Small Nest.js-based project
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.
 
test-assignment-joyn/test/omdbProvider.e2e-spec.ts

39 lines
1.5 KiB

import { describe, it, expect } from '@jest/globals';
import { createOmdbProviderByApiKey } from '../src/integration/movies/omdb';
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);
});