]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Remove jest tests
authorChocobozzz <me@florianbigard.com>
Wed, 13 Mar 2019 15:07:40 +0000 (16:07 +0100)
committerChocobozzz <chocobozzz@cpy.re>
Mon, 18 Mar 2019 10:17:59 +0000 (11:17 +0100)
I don't have time to maintain them

.travis.yml
client/package.json
client/src/app/videos/recommendations/recent-videos-recommendation.service.spec.ts [deleted file]
client/src/app/videos/recommendations/recommended-videos.store.spec.ts [deleted file]
client/src/setupJest.ts [deleted file]
client/src/tsconfig.spec.json [deleted file]
scripts/travis.sh

index d252ae6252b80ab99896ee83147d1cf32599fd45..dcf7247b2d50bbf7e6b426e5ef1691ad5a78df8d 100644 (file)
@@ -45,7 +45,6 @@ matrix:
   - env: TEST_SUITE=api-4
   - env: TEST_SUITE=cli
   - env: TEST_SUITE=lint
-  - env: TEST_SUITE=jest
 
 script:
   - NODE_PENDING_JOB_WAIT=1000 travis_retry npm run travis -- "$TEST_SUITE"
index 72708bd7653d2e71ad55da95f471f3073285289a..a8205a6b99dc0ebe57762183a67042567ab4e8e4 100644 (file)
@@ -20,8 +20,7 @@
     "postinstall": "npm rebuild node-sass",
     "webpack-bundle-analyzer": "webpack-bundle-analyzer",
     "webdriver-manager": "webdriver-manager",
-    "ngx-extractor": "ngx-extractor",
-    "test": "jest --no-cache"
+    "ngx-extractor": "ngx-extractor"
   },
   "license": "GPLv3",
   "typings": "*.d.ts",
     "simple-get": "^2.8.1",
     "punycode": "^1.4.1"
   },
-  "jest": {
-    "globals": {
-      "ts-jest": {
-        "tsConfigFile": "<rootDir>/src/tsconfig.spec.json"
-      },
-      "__TRANSFORM_HTML__": true
-    },
-    "transform": {
-      "^.+\\.(ts|js|html)$": "<rootDir>/node_modules/jest-preset-angular/preprocessor.js"
-    },
-    "moduleNameMapper": {
-      "^@app/(.*)": "<rootDir>/src/app/$1",
-      "environments/(.*)": "<rootDir>/src/environments/$1"
-    },
-    "testMatch": [
-      "**/__tests__/**/*.+(ts|js)?(x)",
-      "**/+(*.)+(spec|test).+(ts|js)?(x)"
-    ],
-    "moduleFileExtensions": [
-      "ts",
-      "tsx",
-      "js",
-      "jsx",
-      "json",
-      "node"
-    ],
-    "transformIgnorePatterns": [
-      "<rootDir>/node_modules/(?!lodash-es/)"
-    ],
-    "preset": "jest-preset-angular",
-    "setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts"
-  },
   "devDependencies": {
     "@angular-devkit/build-angular": "~0.13.1",
     "@angular/animations": "~7.2.4",
@@ -92,7 +59,6 @@
     "@types/hls.js": "^0.12.0",
     "@types/jasmine": "^2.8.7",
     "@types/jasminewd2": "^2.0.3",
-    "@types/jest": "^23.3.1",
     "@types/jschannel": "^1.0.0",
     "@types/linkifyjs": "^2.1.1",
     "@types/lodash-es": "^4.17.0",
     "https-browserify": "^1.0.0",
     "jasmine-core": "^3.1.0",
     "jasmine-spec-reporter": "^4.2.1",
-    "jest": "^23.5.0",
-    "jest-preset-angular": "^6.0.0",
     "jschannel": "^1.0.2",
     "karma": "^3.0.0",
     "karma-chrome-launcher": "^2.2.0",
     "stream-browserify": "^2.0.1",
     "stream-http": "^3.0.0",
     "terser-webpack-plugin": "^1.1.0",
-    "ts-jest": "^23.1.4",
     "tslint": "^5.7.0",
     "tslint-config-standard": "^8.0.1",
     "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 (file)
index 698b2e2..0000000
+++ /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<any>
-    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 (file)
index e12a3f5..0000000
+++ /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 (file)
index 8d88704..0000000
+++ /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 (file)
index cefee17..0000000
+++ /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"
-  ]
-}
index 509b40d873b200e11aaebb6521cd8a3bde5a4c84..3557816c8c48f53b3a06a0d87baa64bc56a0b1db 100755 (executable)
@@ -36,8 +36,4 @@ elif [ "$1" = "lint" ]; then
     ( cd client
       npm run lint
     )
-elif [ "$1" = "jest" ]; then
-    ( cd client
-      npm run test
-    )
 fi