var bag = require('bagofholding'),
  sandbox = require('sandboxed-module'),
  should = require('should'),
  checks, mocks,
  sapi;

describe('sapi', function () {

  function create(checks, mocks) {
    return sandbox.require('../lib/sapi', {
      requires: mocks ? mocks.requires : {},
      globals: {}
    });
  }

  beforeEach(function () {
    checks = {};
    mocks = {};
  });

  describe('bar', function () {

    it('should foo when bar', function () {
    });
  });
});
 
@@ -395,72 +395,1518 @@
 be('
-bar', function () %7B%0A%0A    it('should foo when bar', function () %7B
+sapi', function () %7B%0A%0A    it('should set key and default url when url is not provided', function () %7B%0A      sapi = new (create(checks, mocks))('somekey');%0A      sapi.params.key.should.equal('somekey');%0A      sapi.url.should.equal('http://api.sensis.com.au/ob-20110511/test');%0A    %7D);%0A%0A    it('should set specified key and url when provided', function () %7B%0A      sapi = new (create(checks, mocks))('somekey', 'http://someurl');%0A      sapi.params.key.should.equal('somekey');%0A      sapi.url.should.equal('http://someurl');%0A    %7D);%0A%0A    it('should pass error to callback when an error occurs while sending request', function (done) %7B%0A      mocks.request_err = new Error('someerror');%0A      mocks.requires = %7B%0A        request: bag.mock.request(checks, mocks)%0A      %7D;%0A      sapi = new (create(checks, mocks))();%0A      sapi.search(function cb(err, result) %7B%0A        checks.sapi_search_err = err;%0A        checks.sapi_search_result = result;%0A        done();%0A      %7D);%0A      checks.sapi_search_err.message.should.equal('someerror');%0A      should.not.exist(checks.sapi_search_result);%0A    %7D);%0A  %7D);%0A%0A  describe('proxy', function () %7B%0A%0A    it('should set proxy', function () %7B%0A      sapi = new (create(checks, mocks))('somekey');%0A      sapi.proxy('http://someproxy');%0A      sapi._proxy.should.equal('http://someproxy');%0A    %7D);%0A%0A    it('should allow chainable proxy setting', function () %7B%0A      sapi = new (create(checks, mocks))('somekey').proxy('http://someproxy');%0A      sapi._proxy.should.equal('http://someproxy');
 %0A   

Add constructor and error callback tests.