feat(fs/abstract#rmdir): implement timeout
This commit is contained in:
parent
3814a261d6
commit
48c3748c28
@ -274,7 +274,7 @@ export default class RemoteHandlerAbstract {
|
||||
}
|
||||
|
||||
async rmdir(dir: string): Promise<void> {
|
||||
await this._rmdir(this[kResolve](dir))
|
||||
await timeout.call(this._rmdir(this[kResolve](dir)), this._timeout)
|
||||
}
|
||||
|
||||
async rmtree(dir: string): Promise<void> {
|
||||
|
@ -100,6 +100,18 @@ describe('rename()', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('rmdir()', () => {
|
||||
it(`throws in case of timeout`, async () => {
|
||||
const testHandler = new TestHandler({
|
||||
rmdir: () => new Promise(() => {}),
|
||||
})
|
||||
|
||||
const promise = testHandler.rmdir('dir')
|
||||
jest.advanceTimersByTime(TIMEOUT)
|
||||
await expect(promise).rejects.toThrowError(TimeoutError)
|
||||
})
|
||||
})
|
||||
|
||||
describe('unlink()', () => {
|
||||
it(`throws in case of timeout`, async () => {
|
||||
const testHandler = new TestHandler({
|
||||
|
Loading…
Reference in New Issue
Block a user