Commit 7b5d449e by Ben Drucker

Basic API client

parent 391bd402
'use strict';
var assert = require('assert');
function ClearbitClient (config) {
config = config || {};
assert(this instanceof ClearbitClient, 'Client must be called with new');
assert(!!config.key, 'An API key must be provided');
this.key = config.key;
};
module.exports = ClearbitClient;
\ No newline at end of file
'use strict';
var expect = require('chai').expect;
var ClearbitClient = require('../src/client');
describe('ClearbitClient', function () {
it('must be called with new', function () {
expect(ClearbitClient).to.throw(/called with new/);
});
it('must provide an API key', function () {
expect(function () {
return new ClearbitClient();
})
.to.throw(/API key/);
});
it('configures the API key', function () {
expect(new ClearbitClient({key: 'k'})).to.have.property('key', 'k');
});
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment