Skip to content

Commit

Permalink
chore: adjust code order
Browse files Browse the repository at this point in the history
  • Loading branch information
Layouwen committed Nov 11, 2024
1 parent 9175ac2 commit 3a07d54
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/components/image-uploader/tests/image-uploader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,19 @@ describe('ImageUploader', () => {
})

test('get all upload url', async () => {
function mockUploadWithFailure(failOnCount: number) {
let count = 0
return async () => {
count++
if (count === failOnCount) {
throw new Error('Fail to upload')
}
return {
url: 'count: ' + count,
}
}
}

const fn = jest.fn()
const mockUpload = mockUploadWithFailure(2)

Expand All @@ -412,18 +425,5 @@ describe('ImageUploader', () => {
})

expect(fn.mock.lastCall[0].length).toBe(4)

function mockUploadWithFailure(failOnCount: number) {
let count = 0
return async () => {
count++
if (count === failOnCount) {
throw new Error('Fail to upload')
}
return {
url: 'count: ' + count,
}
}
}
})
})

0 comments on commit 3a07d54

Please sign in to comment.