Skip to content

Commit

Permalink
No mocking with Jest and ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 23, 2022
1 parent 58e4879 commit 7df0f27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion __mocks__/nanoid/non-secure.js

This file was deleted.

7 changes: 6 additions & 1 deletion packages/@uppy/core/src/Uppy.test.js
Expand Up @@ -896,7 +896,12 @@ describe('src/Core', () => {
core.addFile({ source: 'jest', name: 'bar.jpg', type: 'image/jpeg', data: new Uint8Array() })
core.addFile({ source: 'file3', name: 'file3.jpg', type: 'image/jpeg', data: new Uint8Array() })

return expect(core.upload()).resolves.toMatchSnapshot()
// uploadID is random, we don't want randomness in the snapshot
const validateNanoID = r => (
typeof r.uploadID === 'string' && r.uploadID.length === 21 ? ({ ...r, uploadID: 'cjd09qwxb000dlql4tp4doz8h' }) : r
)

return expect(core.upload().then(validateNanoID)).resolves.toMatchSnapshot()
})

it('should not upload if onBeforeUpload returned false', () => {
Expand Down

0 comments on commit 7df0f27

Please sign in to comment.