diff --git a/test/models/conversations_test.js b/test/models/conversations_test.js index 3857d31e..9ac88b1f 100644 --- a/test/models/conversations_test.js +++ b/test/models/conversations_test.js @@ -89,7 +89,13 @@ before(function(done) { var convo = new Whisper.ConversationCollection().add(attributes); convo.save().then(function() { - var message = convo.messageCollection.add({body: 'hello world', conversationId: convo.id}); + var message = convo.messageCollection.add({ + body : 'hello world', + conversationId : convo.id, + type : 'outgoing', + sent_at : Date.now(), + received_at : Date.now() + }); message.save().then(done) }); }); diff --git a/test/models/messages_test.js b/test/models/messages_test.js index 35191711..9a53af77 100644 --- a/test/models/messages_test.js +++ b/test/models/messages_test.js @@ -28,7 +28,7 @@ body: 'hi', conversationId: 'foo', attachments: [], - timestamp: new Date().getTime() }; + received_at: new Date().getTime() }; describe('MessageCollection', function() { before(clear); @@ -81,12 +81,12 @@ tomorrow.setDate(today.getDate()+1); // Add threads - messages.add({ timestamp: today }); - messages.add({ timestamp: tomorrow }); + messages.add({ received_at: today }); + messages.add({ received_at: tomorrow }); var models = messages.models; - var firstTimestamp = models[0].get('timestamp').getTime(); - var secondTimestamp = models[1].get('timestamp').getTime(); + var firstTimestamp = models[0].get('received_at').getTime(); + var secondTimestamp = models[1].get('received_at').getTime(); // Compare timestamps assert(firstTimestamp < secondTimestamp); diff --git a/test/views/message_view_test.js b/test/views/message_view_test.js index 62994605..bc40926d 100644 --- a/test/views/message_view_test.js +++ b/test/views/message_view_test.js @@ -9,7 +9,7 @@ describe('MessageView', function() { conversationId: convo.id, body: 'hello world', type: 'outgoing', - timestamp: new Date().getTime() + received_at: new Date().getTime() }); it('should display the message text', function() { @@ -25,13 +25,13 @@ describe('MessageView', function() { it('should have a nice timestamp', function() { var view = new Whisper.MessageView({model: message}); - message.set({'timestamp': new Date().getTime() - 5000}); + message.set({'received_at': new Date().getTime() - 5000}); assert.match(view.$el.html(), /seconds ago/); - message.set({'timestamp': new Date().getTime() - 60000}); + message.set({'received_at': new Date().getTime() - 60000}); assert.match(view.$el.html(), /minute ago/); - message.set({'timestamp': new Date().getTime() - 3600000}); + message.set({'received_at': new Date().getTime() - 3600000}); assert.match(view.$el.html(), /hour ago/); });