Browse Source

Test for createUpload

Richard Willars 7 years ago
parent
commit
abbaed88cd
1 changed files with 19 additions and 1 deletions
  1. 19 1
      src/core/Core.test.js

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

@@ -839,7 +839,25 @@ describe('src/Core', () => {
   })
 
   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', () => {