/** * @module common */ /** End Typedoc Module Declaration */ import { identifier, ModelStatic, AbstractModel } from '../models/model'; import { Collection } from '../models/collection'; import { AbstractStore } from './store'; import { Injector } from '@angular/core'; /** * Provides abstract class to build concrete mock stores which can create new mock instances of * models. */ export declare abstract class MockStore extends AbstractStore { /** * Instance of chancejs * @see http://chancejs.com */ protected chanceInstance: Chance.Chance; protected modelCollection: Collection; constructor(modelStatic: ModelStatic, injector: Injector); /** * Start the mock store off with some dummy data */ protected initializeMockCollection(): void; /** * Retrieve instance of chance, optionally providing a seed for the internal mersenne twister to * get repeatable random data * @param seed * @returns {ChanceInstance} */ protected chance(seed?: any): Chance.Chance; /** * Get an instance of the model * @param id */ protected abstract getMock(id?: identifier): T; /** * @inheritdoc */ findOne(id?: identifier): Promise; /** * @inheritdoc */ findMany(query?: any): Promise>; /** * Mock saving the model * * As saving does not make sense for a mock store, this just stubs the interface by returning * the model in a resolved promise */ saveOne(model: T): Promise; /** * Mock selecting model by id * * As deleting does not make sense for a mock store, this just stubs the interface by returning * the model in a resolved promise * @param model * @returns {Promise} */ deleteOne(model: T): Promise; /** * @inheritdoc */ hasOne(model: T): Promise; }