Cable-Desktop/libtextsecure/test/protocol_test.js
lilia f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
2015-09-07 14:58:42 -07:00

36 řádky
1,2 KiB
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
'use strict';
describe('Protocol', function() {
describe('Unencrypted PushMessageProto "decrypt"', function() {
//exclusive
it('works', function(done) {
localStorage.clear();
var text_message = new textsecure.protobuf.DataMessage();
text_message.body = "Hi Mom";
var server_message = {
type: 4, // unencrypted
source: "+19999999999",
timestamp: 42,
message: text_message.encode()
};
return textsecure.protocol_wrapper.handleEncryptedMessage(
server_message.source,
server_message.source_device,
server_message.type,
server_message.message
).then(function(message) {
assert.equal(message.body, text_message.body);
assert.equal(message.attachments.length, text_message.attachments.length);
assert.equal(text_message.attachments.length, 0);
}).then(done).catch(done);
});
});
// TODO: Use fake_api's hiding of api.sendMessage to test sendmessage.js' maze
});