JSPM

mongoose-model-stub

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q26056F
  • License BSD

Stub out the database with an in-memory store for tests involving a mongoose module

Package Exports

  • mongoose-model-stub

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mongoose-model-stub) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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