UNPKG

docparse-supplier-nge

Version:

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

31 lines (29 loc) 938 B
var fs = require('fs'); var should = require('should'); var assert = require('assert'); var path = require('path'); var inspect = require('eyespect').inspector(); var getUse = require('../lib/parse/getUse'); describe('Get Use Test', 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 use', function(done) { getUse(pdfText, function (err, reply) { should.not.exist(err); should.exist(reply); reply.units.should.eql('kwh'); reply.quantity.should.eql('20400'); done(); }); }); });