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

    const aliKeys = {};
    aliKeys[aliDeviceId] = aliTestClient.deviceKeys;
    console.log("query result will be", aliKeys);

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

    const aliKeys = {};
    aliKeys[aliDeviceId] = aliTestClient.deviceKeys;
    console.log("query result will be", aliKeys);

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

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