From 4449769a97d0404e7204271fee2a5d579b47d8da Mon Sep 17 00:00:00 2001 From: Inga <52715130+inga-lovinde@users.noreply.github.com> Date: Mon, 11 Dec 2023 01:55:06 +0000 Subject: [PATCH] reorganized tests; implemented api e2e test --- test/app.e2e-spec.ts | 10 +++++++--- test/jest-e2e.json | 2 +- .../omdbApiClient.e2e-spec.ts | 2 +- .../index.spec.ts => test/omdbProvider.e2e-spec.ts | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) rename src/integration/movies/omdb/apiClient.spec.ts => test/omdbApiClient.e2e-spec.ts (95%) rename src/integration/movies/omdb/index.spec.ts => test/omdbProvider.e2e-spec.ts (94%) diff --git a/test/app.e2e-spec.ts b/test/app.e2e-spec.ts index 3bafeb4..aeffa9a 100644 --- a/test/app.e2e-spec.ts +++ b/test/app.e2e-spec.ts @@ -15,10 +15,14 @@ describe('AppController (e2e)', () => { await app.init(); }); - it('/ (GET)', () => { + it('/api/movies/tt0061852 (GET)', () => { return request(app.getHttpServer()) - .get('/') + .get('/api/movies/tt0061852') .expect(200) - .expect('Hello World!'); + .expect((response) => { + expect(response.body).toMatchObject({ + title: 'The Jungle Book', + }); + }); }); }); diff --git a/test/jest-e2e.json b/test/jest-e2e.json index e9d912f..72f1377 100644 --- a/test/jest-e2e.json +++ b/test/jest-e2e.json @@ -2,7 +2,7 @@ "moduleFileExtensions": ["js", "json", "ts"], "rootDir": ".", "testEnvironment": "node", - "testRegex": ".e2e-spec.ts$", + "testRegex": "\\.e2e-spec\\.ts$", "transform": { "^.+\\.(t|j)s$": "ts-jest" } diff --git a/src/integration/movies/omdb/apiClient.spec.ts b/test/omdbApiClient.e2e-spec.ts similarity index 95% rename from src/integration/movies/omdb/apiClient.spec.ts rename to test/omdbApiClient.e2e-spec.ts index aa01e26..b634d95 100644 --- a/src/integration/movies/omdb/apiClient.spec.ts +++ b/test/omdbApiClient.e2e-spec.ts @@ -1,6 +1,6 @@ import { describe, it, expect } from '@jest/globals'; -import { createOmdbApiClient } from './apiClient'; +import { createOmdbApiClient } from '../src/integration/movies/omdb/apiClient'; describe('createOmdbApiClient', () => { const client = createOmdbApiClient('68fd98ab'); diff --git a/src/integration/movies/omdb/index.spec.ts b/test/omdbProvider.e2e-spec.ts similarity index 94% rename from src/integration/movies/omdb/index.spec.ts rename to test/omdbProvider.e2e-spec.ts index 1eb4325..84da44b 100644 --- a/src/integration/movies/omdb/index.spec.ts +++ b/test/omdbProvider.e2e-spec.ts @@ -1,6 +1,6 @@ import { describe, it, expect } from '@jest/globals'; -import { createOmdbProviderByApiKey } from './index'; +import { createOmdbProviderByApiKey } from '../src/integration/movies/omdb'; describe('createOmdbProvider', () => { const client = createOmdbProviderByApiKey('68fd98ab');