Skip to content

Commit fe2bced

Browse files
committed
test(uploader): add batchUpload tests with empty conflict result
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
1 parent 472bcf4 commit fe2bced

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

__tests__/uploader.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,19 @@ describe('Uploader', () => {
122122
expect(() => { uploader.destination = newDestination as unknown as nextcloudFiles.Folder }).toThrowError(/invalid destination/i)
123123
})
124124
})
125+
126+
describe('batchUpload', () => {
127+
test('No upload when skipping all in conflict picker', async () => {
128+
const uploader = new Uploader()
129+
await uploader.batchUpload('/', [new File([], 'file.txt')], () => Promise.resolve([]))
130+
vi.spyOn(uploader, 'upload')
131+
expect(uploader.upload).not.toHaveBeenCalled()
132+
})
133+
134+
test('Empty queue when skipping all in conflict picker', async () => {
135+
const uploader = new Uploader()
136+
await uploader.batchUpload('/', [new File([], 'file.txt')], () => Promise.resolve([]))
137+
expect(uploader.queue).toHaveLength(0)
138+
})
139+
})
125140
})

0 commit comments

Comments
 (0)