From 90140556e4f22a4a7c993ef69f18b53f8d6cec19 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 10 Feb 2015 16:18:20 -0800 Subject: [PATCH] Fix tests --- test/models/conversations_test.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/models/conversations_test.js b/test/models/conversations_test.js index 6c101103..4da84661 100644 --- a/test/models/conversations_test.js +++ b/test/models/conversations_test.js @@ -21,22 +21,30 @@ conversationId: 'foo', attachments: [], timestamp: new Date().getTime() }; + var conversation_attributes= { + type: 'private', + id: '+14155555555' + }; describe('ConversationCollection', function() { before(clearDatabase); after(clearDatabase); - it('adds without saving', function() { + it('adds without saving', function(done) { + var convos = new Whisper.ConversationCollection(); - var message = convos.add(attributes); + convos.add(conversation_attributes); assert.notEqual(convos.length, 0); var convos = new Whisper.ConversationCollection(); - assert.strictEqual(convos.length, 0); + convos.fetch().then(function() { + assert.strictEqual(convos.length, 0); + done(); + }); }); it('saves asynchronously', function(done) { - new Whisper.ConversationCollection().add(attributes).save().then(done); + new Whisper.ConversationCollection().add(conversation_attributes).save().then(done); }); it('fetches persistent convos', function(done) { @@ -44,7 +52,7 @@ assert.strictEqual(convos.length, 0); convos.fetch().then(function() { var m = convos.at(0).attributes; - _.each(attributes, function(val, key) { + _.each(conversation_attributes, function(val, key) { assert.deepEqual(m[key], val); }); done();