spec/integ/matrix-client-crypto.spec.js
function expectAliQueryKeys() {
    // can't query keys before bob has uploaded them
    expect(bobTestClient.deviceKeys).toBeTruthy();

    const bobKeys = {};
    bobKeys[bobDeviceId] = bobTestClient.deviceKeys;
    aliTestClient.httpBackend.when("POST", "/keys/query")
            .respond(200, function(path, content) {
        expect(content.device_keys[bobUserId]).toEqual(
            {},
            "Expected Alice to key query for " + bobUserId + ", got " +
            Object.keys(content.device_keys),
        );
        const result = {};
        result[bobUserId] = bobKeys;
        return {device_keys: result};
    });
    return aliTestClient.httpBackend.flush("/keys/query", 1);
}
function expectAliQueryKeys() {
    // can't query keys before bob has uploaded them
    expect(bobTestClient.deviceKeys).toBeTruthy();

    const bobKeys = {};
    bobKeys[bobDeviceId] = bobTestClient.deviceKeys;
    aliTestClient.httpBackend.when("POST", "/keys/query")
            .respond(200, function(path, content) {
        expect(content.device_keys[bobUserId]).toEqual(
            {},
            "Expected Alice to key query for " + bobUserId + ", got " +
            Object.keys(content.device_keys),
        );
        const result = {};
        result[bobUserId] = bobKeys;
        return {device_keys: result};
    });
    return aliTestClient.httpBackend.flush("/keys/query", 1);
}
function expectAliQueryKeys ( ) { // can't query keys before bob has uploaded them expect ( bobTestClient . deviceKeys ) . toBeTruthy ( ) ; const bobKeys = { } ; bobKeys [ bobDeviceId ] = bobTestClient . deviceKeys ; aliTestClient . httpBackend . when ( "POST" , "/keys/query" ) . respond ( 200 , function ( path , content ) { expect ( content . device_keys [ bobUserId ] ) . toEqual ( { } , "Expected Alice to key query for " + bobUserId + ", got " + Object . keys ( content . device_keys ) , ) ; const result = { } ; result [ bobUserId ] = bobKeys ; return { device_keys : result } ; } ) ; return aliTestClient . httpBackend . flush ( "/keys/query" , 1 ) ; }
Set an expectation that ali will query bobs keys; then flush the http request.

@return {promise} resolves once the http request has completed.
Set an expectation that ali will query bobs keys ; then flush the http request .