Skip to content

Instantly share code, notes, and snippets.

@scarney81
Created May 30, 2012 16:13
Show Gist options
  • Save scarney81/2837339 to your computer and use it in GitHub Desktop.
Save scarney81/2837339 to your computer and use it in GitHub Desktop.
Unit test example
/*globals describe, beforeEach, it */
var should = require('should'),
mockery = require('mockery'),
helpers = require('./helpers'),
Cache = require('../chatter-cache').ChatterCache;
describe('Chatter Cache', function() {
var proxy = null;
beforeEach(function(done) {
helpers.fetchProxy(function(err, data) {
if (err) return done(err);
proxy = data;
done();
});
});
it('Can fetch users', function(done) {
var cache = new Cache(proxy);
cache.users(1, function(err, users) {
if (err) return done(err);
should.exist(users);
users.should.have.property('length');
done();
});
});
it('Can fetch mentions..', function(done) {
var cache = new Cache(proxy);
cache.mentions(1, function(err, mentions) {
if (err) return done(err);
should.exist(mentions);
mentions.should.have.property('length');
done();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment