var chai = require('chai');
var expect = chai.expect;

var options = {
  space: 'cfexampleapi',
  accessToken: 'b4c0n73n7fu1'
};
var contentfulAgent = require('../index.js');

describe('contentful-agent', function(){

  it('should return a function', function(){
    expect(contentfulAgent).to.be.a('function');
  });

  it('should throw an error when no options are passed', function(){
    expect(contentfulAgent).to.throw(Error);
  });

  it('should throw an error when no space is passed', function(){
    expect(function(){
      contentfulAgent({ accessToken: 'token' })
    }).to.throw(Error);
  });

  it('should throw an error when no access token is passed', function(){
    expect(function(){
      contentfulAgent({ space: 'space' })
    }).to.throw(Error);
  });

  it('should return an object with a `get` method when valid options are passed', function(){
    var request = contentfulAgent({ space: 'space', accessToken: 'token' });
    expect(request).to.be.an('object');
    expect(request.get).to.be.a('function');
  });

});

@@ -169,16 +169,82 @@
 .js');%0A%0A
+beforeEach(function()%7B%0A  request = contentfulAgent(options);%0A%7D);%0A%0A
 describe
@@ -1099,12 +1099,1001 @@
 %0A  %7D);%0A%0A%7D);%0A
+%0Adescribe('request', function()%7B%0A%0A  it('should be an object with a %60get%60 method when valid options are passed', function()%7B%0A    expect(request).to.be.an('object');%0A    expect(request.get).to.be.a('function');%0A  %7D);%0A%0A  describe('#get', function()%7B%0A%0A    it('should return a rejected promise when a content type without id is passed', function(done)%7B%0A      var contentTypes = %7B%0A        cats: %7B%7D%0A      %7D;%0A      var promise = request.get(contentTypes);%0A      promise.then(null, function(error)%7B%0A        done();%0A      %7D);%0A    %7D);%0A%0A    it('should resolve the returned promise with the fetched entries', function(done)%7B%0A      var contentTypes = %7B%0A        cats: %7B%0A          id: '63k4qdEi9aI8IQUGaYGg4O'%0A        %7D,%0A        dogs: %7B%0A          id: 'dog'%0A        %7D%0A      %7D;%0A      var promise = request.get(contentTypes);%0A      promise.then(function(entries)%7B%0A        expect(entries.cats.length).to.be.gt(0);%0A        expect(entries.dogs.length).to.be.gt(0);%0A        done();%0A      %7D);%0A    %7D);%0A%0A  %7D);%0A%0A%7D);%0A

add unit tests