simplified testing code

main
Inga 🏳‍🌈 12 months ago
parent 97455f5437
commit 08840712af
  1. 25
      src/integration/movies/omdb/converters.spec.ts
  2. 14
      src/integration/movies/omdb/types.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',

@ -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 =
| {

Loading…
Cancel
Save