import { IBaseRepository } from '../../../repositories/IBaseRepository' ; import { generateMockUUID , generateUserModel } from '../../data/models' ; export class MockBaseRepository implements IBaseRepository < any > { constructor ( public mock ? ) { } public async create ( model ) { const id = generateMockUUID ( ) ; return this . mock || { ... model , id , _id : id } ; } public async update ( _id , model ) { return null ; } public async delete ( _id ) { return { n : 1 } ; } public async find ( skip ? , limit ? , sort ? , query ? ) { const id = generateMockUUID ( ) ; return [ this . mock || { ... generateUserModel ( ) , id , _id : id } ] ; } public async findOne ( query ) { const id = generateMockUUID ( ) ; return this . mock || { ... generateUserModel ( ) , id , _id : id } ; } public async count ( query ) { return 1 ; } }