Skip to content

Commit

Permalink
fixes #78 : Add UnitTests for modules
Browse files Browse the repository at this point in the history
Fixing unit tests for settings module, pushing settings changed does not work if settings.json does not exist
  • Loading branch information
remie committed Sep 20, 2015
1 parent 0b24a55 commit 2e9afa7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/modules/settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,20 @@ describe('YouTransfer Settings module', function() {
// -------------------------------------------------------------------------------------- Testing write

it('should be possible to set title', function(done) {

sandbox.stub(fs, 'readFile', function (file, encoding, callback) {
callback(null, JSON.stringify({}));
});

sandbox.stub(fs, 'writeFile', function (file, data, encoding, callback) {
callback(null);
});

settings.push({ title: title }, function(err) {
should.not.exist(err);
done();
});

});

it('should throw an error if it is not possible to read settings file', function(done) {
Expand Down

0 comments on commit 2e9afa7

Please sign in to comment.