Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #446 from crdlc/bug-1120948
Browse files Browse the repository at this point in the history
Bug 1120948 - [Loop] New name in room isnt visible in rooms list of invi...
  • Loading branch information
Cristian Rodriguez committed Jan 15, 2015
2 parents 8cc837d + e4bf020 commit ccc11ef
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/js/screens/calllog.js
Expand Up @@ -1061,7 +1061,11 @@
_appendRoom(room);
return room;
}, (error) => {
console.error('ERROR when storing the room ' + error);
// Sometimes we don't know if the room already exists and we want to
// update this one. So we can call to this methods and it ensures that the
// room will be created or updated depending on the case.
console.log('Storing the room failed. Trying to update the existing one');
return CallLog.updateRoom(room);
});
}

Expand Down
30 changes: 30 additions & 0 deletions test/unit/test_calllog.js
@@ -0,0 +1,30 @@
'use strict';

require('js/helpers/database_helper.js');
require('js/helpers/rooms_db.js');
require('js/screens/calllog.js');

suite('Tests CallLog', function() {

test('CallLog should exist', function() {
chai.assert.isNotNull(CallLog);
});

test('Update room when addition fails', function(done) {
var room = {
roomToken: 'ab583hfkskls'
};

sinon.stub(CallLog, 'updateRoom', function(myRoom) {
chai.assert.equal(myRoom.roomToken, room.roomToken);
done();
});

sinon.stub(RoomsDB, 'create', function(myRoom) {
return Promise.reject();
});

CallLog.addRoom(room);
});

});

0 comments on commit ccc11ef

Please sign in to comment.