var chai = require('chai'),
    expect = chai.expect,
    chaiAsPromised = require('chai-as-promised'),
    jsdom = require('jsdom'),
    jsdomClient = require('../../lib/websiteAccess/jsdomClient')(jsdom);

chai.use(chaiAsPromised);

describe('jsdomClient test', function() {

    var url = 'http://hipsum.co/';

    it('should get a jQuery function from a URL', function() {
        var p = jsdomClient.getJqueryFunctionFromUrl(url);
        return expect(p).to.eventually.be.a('function')
            .then(function(jQuery) {
                expect(jQuery('.blog-info .blog-title a').text()).to.be.equal('Hipster Ipsum');
        });

    });

});