import samples from '../_sampleData.js' class ProjectMock { constructor (data) { for (let prop in data) { this[prop] = data[prop] } // use this switch to simulate save errors. this._saveError = false // use this switch to simulate remove errors. this._removeError = false } static findOne (criteria, callback) { const { id } = criteria // Find only the entry with id 58d3d6883d34293254afae42 if (id === '58d3d6883d34293254afae42') { callback(undefined, samples[0]) return } // else return 404 callback(Error('item not found'), undefined) } static find (criteria, options, callback) { const { limit, offset } = options // apply criteria const sampleSlice = samples.slice(offset, offset + limit) // return the array if (sampleSlice) { callback(undefined, sampleSlice) return } // if nothing can be shown, return 404 callback(Error('no items found'), undefined) } save (callback) { // } remove (callback) { // } } export default ProjectMock