From e07e3a53c96a24e90287ccdac99171bba9c6330d Mon Sep 17 00:00:00 2001 From: Blake Griffith Date: Mon, 7 Mar 2016 13:07:49 -0600 Subject: [PATCH] Test message.*ImageUrl methods. FREEBIE --- test/models/messages_test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/models/messages_test.js b/test/models/messages_test.js index 42df82cd..f68a2692 100644 --- a/test/models/messages_test.js +++ b/test/models/messages_test.js @@ -18,10 +18,29 @@ attachments: [], received_at: new Date().getTime() }; + var attachment = { data: 'datasaurus', + contentType: 'plain/text' }; + describe('MessageCollection', function() { before(clear); after(clear); + it('has no image url', function() { + var messages = new Whisper.MessageCollection(); + var message = messages.add(attributes); + assert.isNull(message.getImageUrl()); + }); + + it('updates image url', function() { + var messages = new Whisper.MessageCollection(); + var message = messages.add({ attachments: [attachment] }); + + var firstUrl = message.getImageUrl(); + message.updateImageUrl(); + var secondUrl = message.getImageUrl(); + assert.notEqual(secondUrl, firstUrl); + }); + it('adds without saving', function() { var messages = new Whisper.MessageCollection(); var message = messages.add(attributes);