docparse-create-upload

create new upload documents in a test database for use in docparse tests

npm install docparse-create-upload
44 downloads in the last month

Create docparse upload objects for use in testing. The mongoose database is mocked out with an in-memory store

Build Status Dependency Status Dependency tracking by David

Usage

Default object

var inspect = require('eyespect').inspector()
var create = require('docparse-create-upload')
create(function(err, upload) {
  if (err) {
    inspect(err, 'error creating upload')
    return;
  }
  inspect(upload.toObject(), 'created upload');
});

With custom data

var data = {
  billNumber: 'Foo Bill Number',
  accountNumber: 'Foo Account Number',
  remove: true, // remove existing uploads before creating trhis one
    textPages: ['page 1 text', 'page 2 text'],
  hash: 'dummy hash value',
  ocrStatus: {
    complete: true
  },
  status: 'ready to parse',
  supplierData: {
    supplierCode: 'FGS',
    supplierName: 'Foo Gas Supply'
  }
}
var create = require('docparse-create-upload')
create(data, function(err, upload) {
  if (err) {
    inspect(err, 'error creating upload')
    return;
  }
  inspect(upload.toObject(), 'created upload');
});

Installation

npm install docparse-create-upload

npm loves you