philips-software/cogito

View on GitHub
workspaces/demo-app/src/services/file-reader/FileReaderSyncMock.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
const FileReaderSyncMock = function () {
  this.count = 0
  this.readAsArrayBuffer = blob => {
    if (this.count >= FileReaderSyncMock.abs.length) return undefined
    return FileReaderSyncMock.abs[this.count++]
  }
}

FileReaderSyncMock.abs = []
FileReaderSyncMock.prepare = abs => {
  FileReaderSyncMock.abs = abs
}

FileReaderSyncMock.reset = () => {
  FileReaderSyncMock.abs = []
}

export { FileReaderSyncMock }