|
@@ -298,7 +298,6 @@ describe('src/Core', () => {
|
|
|
core.addUploader((fileIDs, uploadID) => {
|
|
|
core.addResultData(uploadID, { upload: 'ok' })
|
|
|
})
|
|
|
- core.run()
|
|
|
return core.upload().then((result) => {
|
|
|
expect(result.pre).toBe('ok')
|
|
|
expect(result.upload).toBe('ok')
|
|
@@ -357,7 +356,6 @@ describe('src/Core', () => {
|
|
|
|
|
|
it('should update the file progress state when preprocess-progress event is fired', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.addFile({
|
|
|
source: 'jest',
|
|
|
name: 'foo.jpg',
|
|
@@ -384,7 +382,6 @@ describe('src/Core', () => {
|
|
|
|
|
|
it('should update the file progress state when preprocess-complete event is fired', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
|
|
|
core.addFile({
|
|
|
source: 'jest',
|
|
@@ -465,7 +462,6 @@ describe('src/Core', () => {
|
|
|
|
|
|
it('should update the file progress state when postprocess-progress event is fired', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
|
|
|
core.addFile({
|
|
|
source: 'jest',
|
|
@@ -493,7 +489,6 @@ describe('src/Core', () => {
|
|
|
|
|
|
it('should update the file progress state when postprocess-complete event is fired', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
|
|
|
core.addFile({
|
|
|
source: 'jest',
|
|
@@ -564,7 +559,6 @@ describe('src/Core', () => {
|
|
|
const fileData = new File([sampleImage], { type: 'image/jpeg' })
|
|
|
const fileAddedEventMock = jest.fn()
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.on('file-added', fileAddedEventMock)
|
|
|
|
|
|
core.addFile({
|
|
@@ -638,7 +632,7 @@ describe('src/Core', () => {
|
|
|
|
|
|
describe('uploading a file', () => {
|
|
|
it('should return a { successful, failed } pair containing file objects', () => {
|
|
|
- const core = new Core().run()
|
|
|
+ const core = new Core()
|
|
|
core.addUploader((fileIDs) => Promise.resolve())
|
|
|
|
|
|
core.addFile({ source: 'jest', name: 'foo.jpg', type: 'image/jpeg', data: new Uint8Array() })
|
|
@@ -654,7 +648,7 @@ describe('src/Core', () => {
|
|
|
})
|
|
|
|
|
|
it('should return files with errors in the { failed } key', () => {
|
|
|
- const core = new Core().run()
|
|
|
+ const core = new Core()
|
|
|
core.addUploader((fileIDs) => {
|
|
|
fileIDs.forEach((fileID) => {
|
|
|
const file = core.getFile(fileID)
|
|
@@ -679,7 +673,7 @@ describe('src/Core', () => {
|
|
|
})
|
|
|
|
|
|
it('should only upload files that are not already assigned to another upload id', () => {
|
|
|
- const core = new Core().run()
|
|
|
+ const core = new Core()
|
|
|
core.store.state.currentUploads = {
|
|
|
upload1: {
|
|
|
fileIDs: ['uppy-file1jpg-image/jpeg', 'uppy-file2jpg-image/jpeg', 'uppy-file3jpg-image/jpeg']
|
|
@@ -738,7 +732,6 @@ describe('src/Core', () => {
|
|
|
|
|
|
const core = new Core()
|
|
|
core.on('file-removed', fileRemovedEventMock)
|
|
|
- core.run()
|
|
|
|
|
|
core.addFile({
|
|
|
source: 'jest',
|
|
@@ -930,7 +923,6 @@ describe('src/Core', () => {
|
|
|
it('should reset the progress', () => {
|
|
|
const resetProgressEvent = jest.fn()
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.on('reset-progress', resetProgressEvent)
|
|
|
|
|
|
core.addFile({
|
|
@@ -1068,14 +1060,12 @@ describe('src/Core', () => {
|
|
|
describe('actions', () => {
|
|
|
it('should update the state when receiving the error event', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.emit('error', new Error('foooooo'))
|
|
|
expect(core.state.error).toEqual('foooooo')
|
|
|
})
|
|
|
|
|
|
it('should update the state when receiving the upload-error event', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.state.files['fileId'] = {
|
|
|
name: 'filename'
|
|
|
}
|
|
@@ -1085,7 +1075,6 @@ describe('src/Core', () => {
|
|
|
|
|
|
it('should reset the error state when receiving the upload event', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.emit('error', { foo: 'bar' })
|
|
|
core.emit('upload')
|
|
|
expect(core.state.error).toEqual(null)
|
|
@@ -1143,7 +1132,6 @@ describe('src/Core', () => {
|
|
|
it('should set a string based message to be displayed infinitely', () => {
|
|
|
const infoVisibleEvent = jest.fn()
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.on('info-visible', infoVisibleEvent)
|
|
|
|
|
|
core.info('This is the message', 'info', 0)
|
|
@@ -1160,7 +1148,6 @@ describe('src/Core', () => {
|
|
|
it('should set a object based message to be displayed infinitely', () => {
|
|
|
const infoVisibleEvent = jest.fn()
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.on('info-visible', infoVisibleEvent)
|
|
|
|
|
|
core.info({
|
|
@@ -1185,7 +1172,6 @@ describe('src/Core', () => {
|
|
|
const infoVisibleEvent = jest.fn()
|
|
|
const infoHiddenEvent = jest.fn()
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.on('info-visible', infoVisibleEvent)
|
|
|
core.on('info-hidden', infoHiddenEvent)
|
|
|
|
|
@@ -1208,7 +1194,6 @@ describe('src/Core', () => {
|
|
|
const infoVisibleEvent = jest.fn()
|
|
|
const infoHiddenEvent = jest.fn()
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.on('info-visible', infoVisibleEvent)
|
|
|
core.on('info-hidden', infoHiddenEvent)
|
|
|
|
|
@@ -1229,7 +1214,6 @@ describe('src/Core', () => {
|
|
|
describe('createUpload', () => {
|
|
|
it('should assign the specified files to a new upload', () => {
|
|
|
const core = new Core()
|
|
|
- core.run()
|
|
|
core.addFile({
|
|
|
source: 'jest',
|
|
|
name: 'foo.jpg',
|