Test message.*ImageUrl methods.

FREEBIE
This commit is contained in:
Blake Griffith 2016-03-07 13:07:49 -06:00 committed by lilia
parent 27dc620566
commit e07e3a53c9

View file

@ -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);