spec/integ/matrix-client-crypto.spec.js
function expectAliSendMessageRequest() {
    return expectSendMessageRequest(aliTestClient.httpBackend).then(function(content) {
        aliMessages.push(content);
        expect(utils.keys(content.ciphertext)).toEqual([bobTestClient.getDeviceKey()]);
        const ciphertext = content.ciphertext[bobTestClient.getDeviceKey()];
        expect(ciphertext).toBeTruthy();
        return ciphertext;
    });
}
function expectAliSendMessageRequest() {
    return expectSendMessageRequest(aliTestClient.httpBackend).then(function(content) {
        aliMessages.push(content);
        expect(utils.keys(content.ciphertext)).toEqual([bobTestClient.getDeviceKey()]);
        const ciphertext = content.ciphertext[bobTestClient.getDeviceKey()];
        expect(ciphertext).toBeTruthy();
        return ciphertext;
    });
}
function expectAliSendMessageRequest ( ) { return expectSendMessageRequest ( aliTestClient . httpBackend ) . then ( function ( content ) { aliMessages . push ( content ) ; expect ( utils . keys ( content . ciphertext ) ) . toEqual ( [ bobTestClient . getDeviceKey ( ) ] ) ; const ciphertext = content . ciphertext [ bobTestClient . getDeviceKey ( ) ] ; expect ( ciphertext ) . toBeTruthy ( ) ; return ciphertext ; } ) ; }
Set an expectation that Ali will send a message, and flush the request

@return {promise} which resolves to the ciphertext for Bob's device.
Set an expectation that Ali will send a message and flush the request