Procházet zdrojové kódy

Test for createUpload

Richard Willars před 7 roky
rodič
revize
abbaed88cd
1 změnil soubory, kde provedl 19 přidání a 1 odebrání
  1. 19 1
      src/core/Core.test.js

+ 19 - 1
src/core/Core.test.js

@@ -839,7 +839,25 @@ describe('src/Core', () => {
   })
   })
 
 
   describe('createUpload', () => {
   describe('createUpload', () => {
-    xit('should assign the specified files to a new upload', () => {})
+    it('should assign the specified files to a new upload', () => {
+      const core = new Core()
+      core.run()
+      return core.addFile({
+        source: 'jest',
+        name: 'foo.jpg',
+        type: 'image/jpg',
+        data: utils.dataURItoFile(sampleImageDataURI, {})
+      }).then(() => {
+        core.createUpload(Object.keys(core.state.files))
+        const uploadId = Object.keys(core.state.currentUploads)[0]
+        const currentUploadsState = {}
+        currentUploadsState[uploadId] = {
+          fileIDs: Object.keys(core.state.files),
+          step: 0
+        }
+        expect(core.state.currentUploads).toEqual(currentUploadsState)
+      })
+    })
   })
   })
 
 
   describe('removeUpload', () => {
   describe('removeUpload', () => {