UNPKG

docparse-scraper-nst

Version:

Node Zombie based scraper to scrape bills from the NStar (supplier code "NST)" website

38 lines (35 loc) 1.07 kB
var should = require('should'); var getDataOnAccountHomepage = require('../lib/getDataOnAccountHomepage'); var config = require('nconf'); var logger = require('./mockLogger'); describe('scrape single account', function () { it('should give error when config field is not set', function (done) { var data = { }; getDataOnAccountHomepage(data, function (err, reply) { should.exist(err); done(); }); }); it('should get data on account homepage correctly', function (done) { var billDates = ['JAN 01, 2011', 'FEB 19 2011']; var bills = function (data, cb) { cb(null, []); }; var getBillDates = function (data, cb) { cb(null, billDates); }; var data = { bills: bills, getBillDates: getBillDates }; getDataOnAccountHomepage(data, function (err, reply) { should.not.exist(err); should.exist(reply); reply.should.have.property('billDates'); reply.should.have.property('billNumbers'); billDates.should.eql(reply.billDates); done(); }); }); });