Skip to content

Instantly share code, notes, and snippets.

@sirkitree
Created February 5, 2012 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sirkitree/1747985 to your computer and use it in GitHub Desktop.
Save sirkitree/1747985 to your computer and use it in GitHub Desktop.
Trying to write a test with SineJS
var fs = require('fs');
var path = require('path');
...
var file = path.join(__dirname, '..', 'tmp', 'todo.txt');
...
describe('.export()', function(done) {
it('should save todos to a file', function(done) {
sinon.stub(storage, 'get', function(key, cb) {
cb(null, [{text: 'Foo', done: false}]);
});
sinon.stub(commands, 'export', function(file) {
fs.readFileSync(file, 'utf8').should.eql(' #1 \u001b[31m✖\u001b[39m Foo');
done();
});
commands.export(file);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment