UNPKG

docparse-supplier-nge

Version:

process ngrid electric utility bill data for use in the docparse system

33 lines (30 loc) 1.08 kB
var should = require('should'); var assert = require('assert'); var path = require('path'); var fs = require('fs'); var inspect = require('eyespect').inspector(); var costOther = require('../lib/parse/otherCosts/getCostOther'); describe('get cost other', function() { var pdfText; before(function (done) { var filePath = path.join(__dirname, 'data/billText.json'); assert.ok(fs.existsSync(filePath, 'default bill text json file not found at path: ' + filePath)); fs.readFile(filePath,'utf8', function (err, text) { should.not.exist(err); var data = JSON.parse(text); should.exist(data); pdfText = data.textPages.join(''); done(); }); }); it('should parse cost other for delivery', function(done) { costOther(pdfText, function (err, reply) { should.not.exist(err, 'error geting other costs:' + err); should.exist(reply); reply.should.have.property('costs'); reply.should.have.property('total'); reply.total.should.eql('135.91', 'wrong total for other costs'); done(); }); }); });