You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
	
	
		
			
				
					
						
							|  |  |  | '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
 | 
					
						
							|  |  |  | }); |