mongoose-model-stub

1.0.2 • Public • Published

Stub out the database with an in-memory store for tests involving a docparse model

Build Status Dependency Status Dependency tracking by David

Usage

var Upload = require('docparse-upload');
var stub = require('docparse-model-stup');
 
// change Upload prototype
stub(Upload);
 
var upload = new Upload();
upload.status = 'dummy status';
upload.hash = 'dummy hash';
upload.supplier_code = 'dummy supplier code';
upload.supplier = new ObjectId();
upload.save(function (err) {
  // note that save will complete even though we have not connected mongoose to a database
  should.not.exist(err, 'error saving upload: ' + err);
  cb(null, upload);
});

Installation

npm install docparse-model-stub

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i mongoose-model-stub

    Weekly Downloads

    1

    Version

    1.0.2

    License

    BSD

    Last publish

    Collaborators

    • clewfirst