Unimodel-Fake: In-Memory Test Database
This package provides two classes: FakeModel
and FakeDocument
. They implement a very basic
in-memory database conforming to unimodel-core specifications. FakeModel
is a SchemaModel
, and
as such, takes a schema.
Here's how it's used:
const FakeModel = FakeModel; const Animal = 'Animal' id: type: String required: true key: true animalType: type: String enum: 'cat' 'dog' 'horse' 'frog' name: String age: Number; Animal; // -> Promise let dog = Animal;dog; // -> Promise Animal; Animalclear; // Clears out all inserted data
All unimodel operations are supported. The standard arguments to find()
are
also supported (sort
, fields
, skip
, limit
).