From 08840712afbe6a2900c75cfde57fe311ac9d3f88 Mon Sep 17 00:00:00 2001 From: Inga <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 10 Dec 2023 10:54:23 +0000 Subject: [PATCH] simplified testing code --- .../movies/omdb/converters.spec.ts | 25 ++++++++----------- src/integration/movies/omdb/types.ts | 14 +++++------ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/integration/movies/omdb/converters.spec.ts b/src/integration/movies/omdb/converters.spec.ts index e6fbba1..5d3779b 100644 --- a/src/integration/movies/omdb/converters.spec.ts +++ b/src/integration/movies/omdb/converters.spec.ts @@ -4,7 +4,7 @@ import { normalizeRawOmdbData } from './converters'; describe('normalizeRawOmdbData', () => { it('normalizes data correctly for tt19500164 (online-release animation)', () => { - const rawOmdbData = { + const result = normalizeRawOmdbData({ Title: 'Nimona', Year: '2023', Rated: 'PG', @@ -32,8 +32,7 @@ describe('normalizeRawOmdbData', () => { BoxOffice: 'N/A', Production: 'N/A', Website: 'N/A', - } as const; - const result = normalizeRawOmdbData(rawOmdbData); + }); expect(result).toEqual({ actors: ['Chloƫ Grace Moretz', 'Riz Ahmed', 'Eugene Lee Yang'], awards: '2 nominations', @@ -60,7 +59,7 @@ describe('normalizeRawOmdbData', () => { }); it('normalizes data correctly for tt10482560 (series)', () => { - const rawOmdbData = { + const result = normalizeRawOmdbData({ Title: 'Kipo and the Age of Wonderbeasts', Year: '2020', Rated: 'TV-Y7', @@ -82,8 +81,7 @@ describe('normalizeRawOmdbData', () => { imdbID: 'tt10482560', Type: 'series', totalSeasons: '3', - } as const; - const result = normalizeRawOmdbData(rawOmdbData); + }); expect(result).toEqual({ actors: ['Karen Fukuhara', 'Sydney Mikayla', 'Dee Bradley Baker'], awards: '3 nominations', @@ -107,7 +105,7 @@ describe('normalizeRawOmdbData', () => { }); it('normalizes data correctly for tt5580266 (cinema-release movie)', () => { - const rawOmdbData = { + const result = normalizeRawOmdbData({ Title: 'The Hate U Give', Year: '2018', Rated: 'PG-13', @@ -136,8 +134,7 @@ describe('normalizeRawOmdbData', () => { BoxOffice: '$29,719,483', Production: 'N/A', Website: 'N/A', - } as const; - const result = normalizeRawOmdbData(rawOmdbData); + }); expect(result).toEqual({ actors: ['Amandla Stenberg', 'Regina Hall', 'Russell Hornsby'], awards: '22 wins & 38 nominations', @@ -167,7 +164,7 @@ describe('normalizeRawOmdbData', () => { }); it('normalizes data correctly for tt1508328 (foreign release)', () => { - const rawOmdbData = { + const result = normalizeRawOmdbData({ Title: 'Pumzi', Year: '2009', Rated: 'N/A', @@ -192,8 +189,7 @@ describe('normalizeRawOmdbData', () => { BoxOffice: 'N/A', Production: 'N/A', Website: 'N/A', - } as const; - const result = normalizeRawOmdbData(rawOmdbData); + }); expect(result).toEqual({ actors: ['Kudzani Moswela', 'Chantelle Burger', 'Tammy Richards'], awards: '3 wins & 2 nominations', @@ -216,7 +212,7 @@ describe('normalizeRawOmdbData', () => { }); it('normalizes data correctly for tt7224520 (local release)', () => { - const rawOmdbData = { + const result = normalizeRawOmdbData({ Title: 'Ever After', Year: '2018', Rated: 'Not Rated', @@ -245,8 +241,7 @@ describe('normalizeRawOmdbData', () => { BoxOffice: 'N/A', Production: 'N/A', Website: 'N/A', - } as const; - const result = normalizeRawOmdbData(rawOmdbData); + }); expect(result).toEqual({ actors: ['Gro Swantje Kohlhof', 'Maja Lehrer', 'Trine Dyrholm'], awards: '3 nominations', diff --git a/src/integration/movies/omdb/types.ts b/src/integration/movies/omdb/types.ts index 2d5a90e..0c758a5 100644 --- a/src/integration/movies/omdb/types.ts +++ b/src/integration/movies/omdb/types.ts @@ -1,4 +1,4 @@ -export type RawOmdbData = Readonly<{ +export type RawOmdbData = { Actors: string; Awards: string; BoxOffice?: string; @@ -12,12 +12,10 @@ export type RawOmdbData = Readonly<{ Poster: string; Production?: string; Rated: string; - Ratings: Readonly< - { - Source: string; - Value: string; - }[] - >; + Ratings: { + Source: string; + Value: string; + }[]; Released: string; Runtime: string; Title: string; @@ -29,7 +27,7 @@ export type RawOmdbData = Readonly<{ imdbRating: string; imdbVotes: string; totalSeasons?: string; -}>; +}; export type OmdbResponse = | {