Files
cordova-plugin-advanced-http/test/mocks/FileReader.mock.js
T
Sefa Ilkimen 594d03aa41 WIP: major progress for #101
- feat(www): implement preprocessor for FormData instances
- feat(www): implement API checks for multipart requests
- feat(android): implement multipart requests
- chore(specs): implement www specs for new prprocessor
2019-11-11 04:49:35 +01:00

40 lines
865 B
JavaScript

module.exports = class FileReaderMock {
constructor() {
this.EMPTY = 0;
this.LOADING = 1;
this.DONE = 2;
this.error = null;
this.onabort = () => {};
this.onerror = () => {};
this.onload = () => {};
this.onloadend = () => {};
this.onloadstart = () => {};
this.onprogress = () => {};
this.readyState = this.EMPTY;
this.result = null;
}
readAsArrayBuffer(file) {
this.readyState = this.LOADING;
this.onloadstart();
this.onprogress();
this.result = file._buffer;
this.readyState = this.DONE;
this.onloadend();
this.onload();
}
readAsBinaryString() {
throw new Error('Not implemented in FileReaderMock.');
}
readAsDataUrl() {
throw new Error('Not implemented in FileReaderMock.');
}
readAsText() {
throw new Error('Not implemented in FileReaderMock.');
}
}