UNPKG

hess-select-profile

Version:

Select a given profile value on the hess energy website https://hessenergy.com

28 lines (26 loc) 1.12 kB
var should = require('should'); var cheerio = require('cheerio') var assert = require('assert') var path = require('path') var fs = require('fs') var getProfileValueOnPage = require('../lib/getProfileValueOnPage') describe('Get Current Profile Value on page', function () { it('should get current profile value when multiple values exist', function () { var desiredValue = '1111' var filePath = path.join(__dirname, 'data/multipleProfileValues.html') var html = fs.readFileSync(filePath, 'utf8') var $ = cheerio.load(html) var currentValue = getProfileValueOnPage($) should.exist(currentValue, 'no profile value returned') currentValue.should.eql(desiredValue) }) it('should get current profile value when multiple values exist', function () { var desiredValue = '6699' var filePath = path.join(__dirname, 'data/defaultProfileOnly.html') var html = fs.readFileSync(filePath, 'utf8') var $ = cheerio.load(html) var currentValue = getProfileValueOnPage($) should.exist(currentValue, 'no profile value returned') currentValue.should.eql(desiredValue) }) })