Bläddra i källkod

Merge pull request #455 from transloadit/chore/jest-22

Update jest
Artur Paikin 7 år sedan
förälder
incheckning
7e2e47a71c
4 ändrade filer med 1063 tillägg och 291 borttagningar
  1. 1053 281
      package-lock.json
  2. 3 3
      package.json
  3. 5 5
      src/core/Core.test.js
  4. 2 2
      src/core/Utils.test.js

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1053 - 281
package-lock.json


+ 3 - 3
package.json

@@ -49,7 +49,7 @@
     "babel-cli": "6.11.4",
     "babel-cli": "6.11.4",
     "babel-core": "6.13.2",
     "babel-core": "6.13.2",
     "babel-eslint": "6.1.2",
     "babel-eslint": "6.1.2",
-    "babel-jest": "^20.0.3",
+    "babel-jest": "^22.0.0",
     "babel-plugin-add-module-exports": "0.2.1",
     "babel-plugin-add-module-exports": "0.2.1",
     "babel-plugin-es6-promise": "1.0.0",
     "babel-plugin-es6-promise": "1.0.0",
     "babel-plugin-transform-object-assign": "6.8.0",
     "babel-plugin-transform-object-assign": "6.8.0",
@@ -67,7 +67,7 @@
     "eslint": "^3.19.0",
     "eslint": "^3.19.0",
     "eslint-config-standard": "^10.2.1",
     "eslint-config-standard": "^10.2.1",
     "eslint-plugin-import": "^2.7.0",
     "eslint-plugin-import": "^2.7.0",
-    "eslint-plugin-jest": "^21.1.0",
+    "eslint-plugin-jest": "^21.5.0",
     "eslint-plugin-node": "^4.2.3",
     "eslint-plugin-node": "^4.2.3",
     "eslint-plugin-promise": "^3.5.0",
     "eslint-plugin-promise": "^3.5.0",
     "eslint-plugin-standard": "^3.0.1",
     "eslint-plugin-standard": "^3.0.1",
@@ -75,7 +75,7 @@
     "fakefile": "0.0.8",
     "fakefile": "0.0.8",
     "glob": "7.1.1",
     "glob": "7.1.1",
     "isomorphic-fetch": "2.2.1",
     "isomorphic-fetch": "2.2.1",
-    "jest": "^20.0.4",
+    "jest": "^22.0.0",
     "lint-staged": "2.0.2",
     "lint-staged": "2.0.2",
     "minify-stream": "^1.1.0",
     "minify-stream": "^1.1.0",
     "mkdirp": "0.5.1",
     "mkdirp": "0.5.1",

+ 5 - 5
src/core/Core.test.js

@@ -601,7 +601,7 @@ describe('src/Core', () => {
         name: 'foo.jpg',
         name: 'foo.jpg',
         type: 'image/jpeg',
         type: 'image/jpeg',
         data: null
         data: null
-      })).rejects.toMatchObject({ message: 'onBeforeFileAdded: a plain string' })
+      })).rejects.toMatchObject(new Error('onBeforeFileAdded: a plain string'))
     })
     })
 
 
     it('should call utils.generatePreview when file-added is triggered and thumbnail generation is allowed', () => {
     it('should call utils.generatePreview when file-added is triggered and thumbnail generation is allowed', () => {
@@ -935,7 +935,7 @@ describe('src/Core', () => {
         name: 'foo2.jpg',
         name: 'foo2.jpg',
         type: 'image/jpeg',
         type: 'image/jpeg',
         data: utils.dataURItoFile(sampleImageDataURI, {})
         data: utils.dataURItoFile(sampleImageDataURI, {})
-      })).rejects.toMatchObject({ message: 'File not allowed' }).then(() => {
+      })).rejects.toMatchObject(new Error('File not allowed')).then(() => {
         expect(core.state.info.message).toEqual('You can only upload 1 file')
         expect(core.state.info.message).toEqual('You can only upload 1 file')
       })
       })
     })
     })
@@ -955,7 +955,7 @@ describe('src/Core', () => {
         name: 'foo2.jpg',
         name: 'foo2.jpg',
         type: 'image/jpeg',
         type: 'image/jpeg',
         data: utils.dataURItoFile(sampleImageDataURI, {})
         data: utils.dataURItoFile(sampleImageDataURI, {})
-      })).rejects.toMatchObject({ message: 'File not allowed' }).then(() => {
+      })).rejects.toMatchObject(new Error('File not allowed')).then(() => {
         expect(core.state.info.message).toEqual('You can only upload: image/gif, image/png')
         expect(core.state.info.message).toEqual('You can only upload: image/gif, image/png')
       })
       })
     })
     })
@@ -973,7 +973,7 @@ describe('src/Core', () => {
         name: 'foo.jpg',
         name: 'foo.jpg',
         type: 'image/jpeg',
         type: 'image/jpeg',
         data: utils.dataURItoFile(sampleImageDataURI, {})
         data: utils.dataURItoFile(sampleImageDataURI, {})
-      })).rejects.toMatchObject({ message: 'File not allowed' }).then(() => {
+      })).rejects.toMatchObject(new Error('File not allowed')).then(() => {
         expect(core.state.info.message).toEqual('This file exceeds maximum allowed size of 1.2 KB')
         expect(core.state.info.message).toEqual('This file exceeds maximum allowed size of 1.2 KB')
       })
       })
     })
     })
@@ -993,7 +993,7 @@ describe('src/Core', () => {
       core.state.files['fileId'] = {
       core.state.files['fileId'] = {
         name: 'filename'
         name: 'filename'
       }
       }
-      core.emit('upload-error', 'fileId', { message: 'this is the error' })
+      core.emit('upload-error', 'fileId', new Error('this is the error'))
       expect(core.state.info).toEqual({'message': 'Failed to upload filename', 'details': 'this is the error', 'isHidden': false, 'type': 'error'})
       expect(core.state.info).toEqual({'message': 'Failed to upload filename', 'details': 'this is the error', 'isHidden': false, 'type': 'error'})
     })
     })
 
 

+ 2 - 2
src/core/Utils.test.js

@@ -363,7 +363,7 @@ describe('core/utils', () => {
         ])
         ])
       ).resolves.toMatchObject({
       ).resolves.toMatchObject({
         successful: [],
         successful: [],
-        failed: [{ message: 'oops' }, { message: 'this went wrong' }]
+        failed: [ new Error('oops'), new Error('this went wrong') ]
       })
       })
     })
     })
 
 
@@ -376,7 +376,7 @@ describe('core/utils', () => {
         ])
         ])
       ).resolves.toMatchObject({
       ).resolves.toMatchObject({
         successful: ['resolved', 'also-resolved'],
         successful: ['resolved', 'also-resolved'],
-        failed: [{ message: 'rejected' }]
+        failed: [new Error('rejected')]
       })
       })
     })
     })
   })
   })

Vissa filer visades inte eftersom för många filer har ändrats