| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 | 
							- import projects from '../_sampleData.js'
 
- class ProjectMock {
 
-   constructor (data) {
 
-     for (let prop in data) {
 
-       this[prop] = data[prop]
 
-     }
 
-     this.modelName = 'project'
 
-     // use this switch to simulate save errors.
 
-     this._saveError = false
 
-     // use this switch to simulate remove errors.
 
-     this._removeError = false
 
-   }
 
-   static get schema () { return { obj: { __history: {} } } }
 
-   static findOne (criteria, callback) {
 
-     const { _id, tag } = criteria
 
-     let foundProject
 
-     if (typeof _id !== 'undefined') {
 
-       foundProject = projects.find(project => {
 
-         return (_id.equals(project._id))
 
-       })
 
-     } else if (typeof tag !== 'undefined') {
 
-       foundProject = projects.find(project => {
 
-         return (tag === project.tag && project.history.head === true)
 
-       })
 
-     }
 
-     if (foundProject) {
 
-       // return the project
 
-       callback(undefined, foundProject)
 
-     } else {
 
-       // else return 404
 
-       callback(Error('item not found'), undefined)
 
-     }
 
-   }
 
-   static find (criteria, options, callback) {
 
-     let { limit, skip } = options
 
-     const onlyHead = criteria['history.head']
 
-     const projectsFiltered = projects.filter(project => {
 
-       return project.history.head
 
-     })
 
-     // apply criteria
 
-     const projectsSlice = projectsFiltered.slice(skip, skip + limit)
 
-     if (projectsSlice) {
 
-       // return the array
 
-       callback(undefined, projectsSlice)
 
-     } else {
 
-       // if nothing can be shown, return 404
 
-       callback(Error('no items found'), undefined)
 
-     }
 
-   }
 
-   save () {
 
-     throw Error('save not implemented.')
 
-   }
 
-   remove () {
 
-     throw Error('remove not implemented.')
 
-   }
 
- }
 
- export default ProjectMock
 
 
  |