From d0e1e32589f4e76446eb84a3ec8e7fea39963412 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 13 Mar 2019 16:07:40 +0100 Subject: Remove jest tests I don't have time to maintain them --- .../recent-videos-recommendation.service.spec.ts | 66 ---------------------- .../recommended-videos.store.spec.ts | 22 -------- client/src/setupJest.ts | 1 - client/src/tsconfig.spec.json | 17 ------ 4 files changed, 106 deletions(-) delete mode 100644 client/src/app/videos/recommendations/recent-videos-recommendation.service.spec.ts delete mode 100644 client/src/app/videos/recommendations/recommended-videos.store.spec.ts delete mode 100644 client/src/setupJest.ts delete mode 100644 client/src/tsconfig.spec.json (limited to 'client/src') diff --git a/client/src/app/videos/recommendations/recent-videos-recommendation.service.spec.ts b/client/src/app/videos/recommendations/recent-videos-recommendation.service.spec.ts deleted file mode 100644 index 698b2e27b..000000000 --- a/client/src/app/videos/recommendations/recent-videos-recommendation.service.spec.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' -import { VideosProvider } from '@app/shared/video/video.service' -import { EMPTY, of } from 'rxjs' -import Mock = jest.Mock - -describe('"Recent Videos" Recommender', () => { - describe('getRecommendations', () => { - let videosService: VideosProvider - let service: RecentVideosRecommendationService - let getVideosMock: Mock - beforeEach(() => { - getVideosMock = jest.fn(() => EMPTY) - videosService = { - getVideos: getVideosMock - } - service = new RecentVideosRecommendationService(videosService) - }) - it('should filter out the given UUID from the results', async (done) => { - const vids = [ - { uuid: 'uuid1' }, - { uuid: 'uuid2' } - ] - getVideosMock.mockReturnValueOnce(of({ videos: vids })) - const result = await service.getRecommendations({ uuid: 'uuid1' }).toPromise() - const uuids = result.map(v => v.uuid) - expect(uuids).toEqual(['uuid2']) - done() - }) - it('should return 5 results when the given UUID is NOT in the first 5 results', async (done) => { - const vids = [ - { uuid: 'uuid2' }, - { uuid: 'uuid3' }, - { uuid: 'uuid4' }, - { uuid: 'uuid5' }, - { uuid: 'uuid6' }, - { uuid: 'uuid7' } - ] - getVideosMock.mockReturnValueOnce(of({ videos: vids })) - const result = await service.getRecommendations({ uuid: 'uuid1' }).toPromise() - expect(result.length).toEqual(5) - done() - }) - it('should return 5 results when the given UUID IS PRESENT in the first 5 results', async (done) => { - const vids = [ - { uuid: 'uuid1' }, - { uuid: 'uuid2' }, - { uuid: 'uuid3' }, - { uuid: 'uuid4' }, - { uuid: 'uuid5' }, - { uuid: 'uuid6' } - ] - getVideosMock - .mockReturnValueOnce(of({ videos: vids })) - const result = await service.getRecommendations({ uuid: 'uuid1' }).toPromise() - expect(result.length).toEqual(5) - done() - }) - it('should fetch an extra result in case the given UUID is in the list', async (done) => { - await service.getRecommendations({ uuid: 'uuid1' }).toPromise() - let expectedSize = service.pageSize + 1 - let params = { currentPage: jasmine.anything(), itemsPerPage: expectedSize } - expect(getVideosMock).toHaveBeenCalledWith(params, jasmine.anything()) - done() - }) - }) -}) diff --git a/client/src/app/videos/recommendations/recommended-videos.store.spec.ts b/client/src/app/videos/recommendations/recommended-videos.store.spec.ts deleted file mode 100644 index e12a3f520..000000000 --- a/client/src/app/videos/recommendations/recommended-videos.store.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' -import { RecommendationService } from '@app/videos/recommendations/recommendations.service' - -describe('RecommendedVideosStore', () => { - describe('requestNewRecommendations', () => { - let store: RecommendedVideosStore - let service: RecommendationService - beforeEach(() => { - service = { - getRecommendations: jest.fn(() => new Promise((r) => r())) - } - store = new RecommendedVideosStore(service) - }) - it('should pull new videos from the service one time when given the same UUID twice', () => { - store.requestNewRecommendations('some-uuid') - store.requestNewRecommendations('some-uuid') - // Requests aren't fulfilled until someone asks for them (ie: subscribes) - store.recommendations$.subscribe() - expect(service.getRecommendations).toHaveBeenCalledTimes(1) - }) - }) -}) diff --git a/client/src/setupJest.ts b/client/src/setupJest.ts deleted file mode 100644 index 8d88704e8..000000000 --- a/client/src/setupJest.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest-preset-angular'; diff --git a/client/src/tsconfig.spec.json b/client/src/tsconfig.spec.json deleted file mode 100644 index cefee1781..000000000 --- a/client/src/tsconfig.spec.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/spec", - "module": "commonjs", - "target": "es5", - "baseUrl": "", - "allowJs": true - }, - "files": [ - "test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} -- cgit v1.2.3