UNPKG

ngrid-electric-login

Version:

Login to the NGrid Electric website using curl

28 lines (27 loc) 839 B
var fs = require('fs') var cheerio = require('cheerio') var path = require('path') var rewire = require('rewire') var should = require('should'); var getSignInPageData = require('../getSignInPageData') describe('Get Sign In Page Data Wiring', function () { var $ before(function () { var filePath = path.join(__dirname,'data/signInPage.html') var html = fs.readFileSync(filePath, 'utf8') $ = cheerio.load(html) }) it('should be wired up correctly', function (done) { var getSignInPageData = rewire('../getSignInPageData') getSignInPageData.__set__('getSignInPage', function(cb) { cb(null, $) }) getSignInPageData(function (err, reply) { should.not.exist(err) should.exist(reply) should.exist(reply.viewState) should.exist(reply.eventValidation) done() }) }) })