diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-13 16:07:40 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | d0e1e32589f4e76446eb84a3ec8e7fea39963412 (patch) | |
tree | 201423c677e61490d8e289a9cb9f39cc0e76e3ed /client | |
parent | 0b16f5f2202e0c0832b5e678fadd95c64b8e8789 (diff) | |
download | PeerTube-d0e1e32589f4e76446eb84a3ec8e7fea39963412.tar.gz PeerTube-d0e1e32589f4e76446eb84a3ec8e7fea39963412.tar.zst PeerTube-d0e1e32589f4e76446eb84a3ec8e7fea39963412.zip |
Remove jest tests
I don't have time to maintain them
Diffstat (limited to 'client')
-rw-r--r-- | client/package.json | 39 | ||||
-rw-r--r-- | client/src/app/videos/recommendations/recent-videos-recommendation.service.spec.ts | 66 | ||||
-rw-r--r-- | client/src/app/videos/recommendations/recommended-videos.store.spec.ts | 22 | ||||
-rw-r--r-- | client/src/setupJest.ts | 1 | ||||
-rw-r--r-- | client/src/tsconfig.spec.json | 17 |
5 files changed, 1 insertions, 144 deletions
diff --git a/client/package.json b/client/package.json index 72708bd76..a8205a6b9 100644 --- a/client/package.json +++ b/client/package.json | |||
@@ -20,8 +20,7 @@ | |||
20 | "postinstall": "npm rebuild node-sass", | 20 | "postinstall": "npm rebuild node-sass", |
21 | "webpack-bundle-analyzer": "webpack-bundle-analyzer", | 21 | "webpack-bundle-analyzer": "webpack-bundle-analyzer", |
22 | "webdriver-manager": "webdriver-manager", | 22 | "webdriver-manager": "webdriver-manager", |
23 | "ngx-extractor": "ngx-extractor", | 23 | "ngx-extractor": "ngx-extractor" |
24 | "test": "jest --no-cache" | ||
25 | }, | 24 | }, |
26 | "license": "GPLv3", | 25 | "license": "GPLv3", |
27 | "typings": "*.d.ts", | 26 | "typings": "*.d.ts", |
@@ -31,38 +30,6 @@ | |||
31 | "simple-get": "^2.8.1", | 30 | "simple-get": "^2.8.1", |
32 | "punycode": "^1.4.1" | 31 | "punycode": "^1.4.1" |
33 | }, | 32 | }, |
34 | "jest": { | ||
35 | "globals": { | ||
36 | "ts-jest": { | ||
37 | "tsConfigFile": "<rootDir>/src/tsconfig.spec.json" | ||
38 | }, | ||
39 | "__TRANSFORM_HTML__": true | ||
40 | }, | ||
41 | "transform": { | ||
42 | "^.+\\.(ts|js|html)$": "<rootDir>/node_modules/jest-preset-angular/preprocessor.js" | ||
43 | }, | ||
44 | "moduleNameMapper": { | ||
45 | "^@app/(.*)": "<rootDir>/src/app/$1", | ||
46 | "environments/(.*)": "<rootDir>/src/environments/$1" | ||
47 | }, | ||
48 | "testMatch": [ | ||
49 | "**/__tests__/**/*.+(ts|js)?(x)", | ||
50 | "**/+(*.)+(spec|test).+(ts|js)?(x)" | ||
51 | ], | ||
52 | "moduleFileExtensions": [ | ||
53 | "ts", | ||
54 | "tsx", | ||
55 | "js", | ||
56 | "jsx", | ||
57 | "json", | ||
58 | "node" | ||
59 | ], | ||
60 | "transformIgnorePatterns": [ | ||
61 | "<rootDir>/node_modules/(?!lodash-es/)" | ||
62 | ], | ||
63 | "preset": "jest-preset-angular", | ||
64 | "setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts" | ||
65 | }, | ||
66 | "devDependencies": { | 33 | "devDependencies": { |
67 | "@angular-devkit/build-angular": "~0.13.1", | 34 | "@angular-devkit/build-angular": "~0.13.1", |
68 | "@angular/animations": "~7.2.4", | 35 | "@angular/animations": "~7.2.4", |
@@ -92,7 +59,6 @@ | |||
92 | "@types/hls.js": "^0.12.0", | 59 | "@types/hls.js": "^0.12.0", |
93 | "@types/jasmine": "^2.8.7", | 60 | "@types/jasmine": "^2.8.7", |
94 | "@types/jasminewd2": "^2.0.3", | 61 | "@types/jasminewd2": "^2.0.3", |
95 | "@types/jest": "^23.3.1", | ||
96 | "@types/jschannel": "^1.0.0", | 62 | "@types/jschannel": "^1.0.0", |
97 | "@types/linkifyjs": "^2.1.1", | 63 | "@types/linkifyjs": "^2.1.1", |
98 | "@types/lodash-es": "^4.17.0", | 64 | "@types/lodash-es": "^4.17.0", |
@@ -120,8 +86,6 @@ | |||
120 | "https-browserify": "^1.0.0", | 86 | "https-browserify": "^1.0.0", |
121 | "jasmine-core": "^3.1.0", | 87 | "jasmine-core": "^3.1.0", |
122 | "jasmine-spec-reporter": "^4.2.1", | 88 | "jasmine-spec-reporter": "^4.2.1", |
123 | "jest": "^23.5.0", | ||
124 | "jest-preset-angular": "^6.0.0", | ||
125 | "jschannel": "^1.0.2", | 89 | "jschannel": "^1.0.2", |
126 | "karma": "^3.0.0", | 90 | "karma": "^3.0.0", |
127 | "karma-chrome-launcher": "^2.2.0", | 91 | "karma-chrome-launcher": "^2.2.0", |
@@ -153,7 +117,6 @@ | |||
153 | "stream-browserify": "^2.0.1", | 117 | "stream-browserify": "^2.0.1", |
154 | "stream-http": "^3.0.0", | 118 | "stream-http": "^3.0.0", |
155 | "terser-webpack-plugin": "^1.1.0", | 119 | "terser-webpack-plugin": "^1.1.0", |
156 | "ts-jest": "^23.1.4", | ||
157 | "tslint": "^5.7.0", | 120 | "tslint": "^5.7.0", |
158 | "tslint-config-standard": "^8.0.1", | 121 | "tslint-config-standard": "^8.0.1", |
159 | "typescript": "3.2", | 122 | "typescript": "3.2", |
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 @@ | |||
1 | import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' | ||
2 | import { VideosProvider } from '@app/shared/video/video.service' | ||
3 | import { EMPTY, of } from 'rxjs' | ||
4 | import Mock = jest.Mock | ||
5 | |||
6 | describe('"Recent Videos" Recommender', () => { | ||
7 | describe('getRecommendations', () => { | ||
8 | let videosService: VideosProvider | ||
9 | let service: RecentVideosRecommendationService | ||
10 | let getVideosMock: Mock<any> | ||
11 | beforeEach(() => { | ||
12 | getVideosMock = jest.fn(() => EMPTY) | ||
13 | videosService = { | ||
14 | getVideos: getVideosMock | ||
15 | } | ||
16 | service = new RecentVideosRecommendationService(videosService) | ||
17 | }) | ||
18 | it('should filter out the given UUID from the results', async (done) => { | ||
19 | const vids = [ | ||
20 | { uuid: 'uuid1' }, | ||
21 | { uuid: 'uuid2' } | ||
22 | ] | ||
23 | getVideosMock.mockReturnValueOnce(of({ videos: vids })) | ||
24 | const result = await service.getRecommendations({ uuid: 'uuid1' }).toPromise() | ||
25 | const uuids = result.map(v => v.uuid) | ||
26 | expect(uuids).toEqual(['uuid2']) | ||
27 | done() | ||
28 | }) | ||
29 | it('should return 5 results when the given UUID is NOT in the first 5 results', async (done) => { | ||
30 | const vids = [ | ||
31 | { uuid: 'uuid2' }, | ||
32 | { uuid: 'uuid3' }, | ||
33 | { uuid: 'uuid4' }, | ||
34 | { uuid: 'uuid5' }, | ||
35 | { uuid: 'uuid6' }, | ||
36 | { uuid: 'uuid7' } | ||
37 | ] | ||
38 | getVideosMock.mockReturnValueOnce(of({ videos: vids })) | ||
39 | const result = await service.getRecommendations({ uuid: 'uuid1' }).toPromise() | ||
40 | expect(result.length).toEqual(5) | ||
41 | done() | ||
42 | }) | ||
43 | it('should return 5 results when the given UUID IS PRESENT in the first 5 results', async (done) => { | ||
44 | const vids = [ | ||
45 | { uuid: 'uuid1' }, | ||
46 | { uuid: 'uuid2' }, | ||
47 | { uuid: 'uuid3' }, | ||
48 | { uuid: 'uuid4' }, | ||
49 | { uuid: 'uuid5' }, | ||
50 | { uuid: 'uuid6' } | ||
51 | ] | ||
52 | getVideosMock | ||
53 | .mockReturnValueOnce(of({ videos: vids })) | ||
54 | const result = await service.getRecommendations({ uuid: 'uuid1' }).toPromise() | ||
55 | expect(result.length).toEqual(5) | ||
56 | done() | ||
57 | }) | ||
58 | it('should fetch an extra result in case the given UUID is in the list', async (done) => { | ||
59 | await service.getRecommendations({ uuid: 'uuid1' }).toPromise() | ||
60 | let expectedSize = service.pageSize + 1 | ||
61 | let params = { currentPage: jasmine.anything(), itemsPerPage: expectedSize } | ||
62 | expect(getVideosMock).toHaveBeenCalledWith(params, jasmine.anything()) | ||
63 | done() | ||
64 | }) | ||
65 | }) | ||
66 | }) | ||
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 @@ | |||
1 | import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' | ||
2 | import { RecommendationService } from '@app/videos/recommendations/recommendations.service' | ||
3 | |||
4 | describe('RecommendedVideosStore', () => { | ||
5 | describe('requestNewRecommendations', () => { | ||
6 | let store: RecommendedVideosStore | ||
7 | let service: RecommendationService | ||
8 | beforeEach(() => { | ||
9 | service = { | ||
10 | getRecommendations: jest.fn(() => new Promise((r) => r())) | ||
11 | } | ||
12 | store = new RecommendedVideosStore(service) | ||
13 | }) | ||
14 | it('should pull new videos from the service one time when given the same UUID twice', () => { | ||
15 | store.requestNewRecommendations('some-uuid') | ||
16 | store.requestNewRecommendations('some-uuid') | ||
17 | // Requests aren't fulfilled until someone asks for them (ie: subscribes) | ||
18 | store.recommendations$.subscribe() | ||
19 | expect(service.getRecommendations).toHaveBeenCalledTimes(1) | ||
20 | }) | ||
21 | }) | ||
22 | }) | ||
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 @@ | |||
1 | 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 @@ | |||
1 | { | ||
2 | "extends": "../tsconfig.json", | ||
3 | "compilerOptions": { | ||
4 | "outDir": "../out-tsc/spec", | ||
5 | "module": "commonjs", | ||
6 | "target": "es5", | ||
7 | "baseUrl": "", | ||
8 | "allowJs": true | ||
9 | }, | ||
10 | "files": [ | ||
11 | "test.ts" | ||
12 | ], | ||
13 | "include": [ | ||
14 | "**/*.spec.ts", | ||
15 | "**/*.d.ts" | ||
16 | ] | ||
17 | } | ||