Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 5dba26f.
- Loading branch information
Showing
5 changed files
with
16 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,5 @@ | |
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"nock": "^13.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
const Core = require('@uppy/core') | ||
const nock = require('nock') | ||
|
||
const Tus = require('.') | ||
|
||
const KB = 1024 | ||
|
||
describe('Tus', () => { | ||
it('Throws errors if autoRetry option is passed', () => { | ||
it('Throws errors if autoRetry option is true', () => { | ||
const uppy = new Core() | ||
const errorMsg = /The `autoRetry` option was deprecated and has been removed/ | ||
|
||
expect(() => uppy.use(Tus, { autoRetry: true })).toThrowError(errorMsg) | ||
expect(() => uppy.use(Tus, { autoRetry: false })).toThrowError(errorMsg) | ||
expect(() => uppy.use(Tus, { autoRetry: undefined })).toThrowError(errorMsg) | ||
expect(() => { | ||
uppy.use(Tus, { autoRetry: true }) | ||
}).toThrowError(/The `autoRetry` option was deprecated and has been removed/) | ||
}) | ||
|
||
it('should do POST request again when retrying', async () => { | ||
it('Throws errors if autoRetry option is false', () => { | ||
const uppy = new Core() | ||
const endpoint = 'https://tusd.tusdemo.net/files/' | ||
const scope = nock(endpoint) | ||
|
||
scope.post('/').reply(201) | ||
|
||
uppy.use(Tus, { endpoint }) | ||
uppy.addFile({ | ||
source: 'jest', | ||
name: 'foo1.jpg', | ||
type: 'image/jpeg', | ||
data: new File([Buffer.alloc(KB)], { type: 'image/jpeg' }), | ||
}) | ||
uppy.on('complete', (result) => expect(result.successful.length).toEqual(1)) | ||
expect(() => { | ||
uppy.use(Tus, { autoRetry: false }) | ||
}).toThrowError(/The `autoRetry` option was deprecated and has been removed/) | ||
}) | ||
|
||
await uppy.upload() | ||
it('Throws errors if autoRetry option is `undefined`', () => { | ||
const uppy = new Core() | ||
|
||
scope.done() | ||
expect(() => { | ||
uppy.use(Tus, { autoRetry: undefined }) | ||
}).toThrowError(/The `autoRetry` option was deprecated and has been removed/) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters