mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-22 17:58:05 +00:00
* Update eslint * Do eslint --fix * Do not access Object.prototype method 'hasOwnProperty' from target object * utils: add hasProperty * eslint --fix * Disable quote-props for locale files * add back quotes in locale files * revert locale files to state on master * Update react-scripts
28 lines
785 B
JavaScript
28 lines
785 B
JavaScript
const settle = require('./settle')
|
|
|
|
describe('settle', () => {
|
|
it('should resolve even if all input promises reject', async () => {
|
|
await expect(
|
|
settle([
|
|
Promise.reject(new Error('oops')),
|
|
Promise.reject(new Error('this went wrong'))
|
|
])
|
|
).resolves.toMatchObject({
|
|
successful: [],
|
|
failed: [new Error('oops'), new Error('this went wrong')]
|
|
})
|
|
})
|
|
|
|
it('should resolve with an object if some input promises resolve', async () => {
|
|
await expect(
|
|
settle([
|
|
Promise.reject(new Error('rejected')),
|
|
Promise.resolve('resolved'),
|
|
Promise.resolve('also-resolved')
|
|
])
|
|
).resolves.toMatchObject({
|
|
successful: ['resolved', 'also-resolved'],
|
|
failed: [new Error('rejected')]
|
|
})
|
|
})
|
|
})
|