docparse-supplier-nge
Version:
process ngrid electric utility bill data for use in the docparse system
43 lines (41 loc) • 1.14 kB
JavaScript
var inspect = require('eyespect').inspector();
var should = require('should');
var path = require('path');
var createInvoices = require('../lib/createInvoices');
describe('Create Invoices', function() {
this.slow('1s');
it('should create invoice with default parameters', function(done) {
var invoice = {
_id: 'foo id'
};
var saveInvoice = function (data, cb) {
cb(null, invoice);
};
var add = function (data, cb) {
var bill = data.bill;
var invoiceID = data.invoiceID;
bill.invoices.push(invoiceID);
cb(null, invoice);
};
var createInvoice = function (data, cb) {
cb(null, invoice);
};
var createCompInvoice = function (data, cb) {
cb(null, invoice);
};
var data = {
add: add,
createInvoice: createInvoice,
createCompInvoice: createCompInvoice,
saveInvoice: saveInvoice,
bill: {
invoices: []
}
};
createInvoices(data, function (err, reply) {
should.not.exist(err);
should.exist(reply, 'no invoice object returned from createInvoice module');
done();
});
});
});