UNPKG

docparse-supplier-nge

Version:

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

30 lines (28 loc) 945 B
var fs = require('fs'); var should = require('should'); var assert = require('assert'); var path = require('path'); var inspect = require('eyespect').inspector(); var getCostDelivery = require('../lib/parse/getCostDelivery'); describe('NGrid Electric Cost Delivery', 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 get correct values for costDelivery', function(done) { getCostDelivery(pdfText, function (err, reply) { should.not.exist(err); should.exist(reply); reply.should.eql('700.22'); done(); }); }); });