spec/providers/social/social.double.integration.src.js
function(arr, info) {
      if (typeof arr !== "undefined") {
        arr.push(info);
      }
      if (!triggered &&
          seeBoth(c1ProfileEvts, "userId") && seeBoth(c2ProfileEvts, "userId") &&
          seeBoth(c1StateEvts, "clientId") && seeBoth(c2StateEvts, "clientId")) {
        triggered = true;
        Promise.all([ c1.getUsers(), c2.getUsers(), c1.getClients(), c2.getClients() ]).then(function(ret) {
          expect(ret[0][c1State.userId]).toEqual(Helper.makeUserProfile(c1State.userId));
          expect(ret[0][c2State.userId]).toEqual(Helper.makeUserProfile(c2State.userId));
          expect(ret[1][c1State.userId]).toEqual(Helper.makeUserProfile(c1State.userId));
          expect(ret[1][c2State.userId]).toEqual(Helper.makeUserProfile(c2State.userId));
          expect(ret[2][c1State.clientId]).toEqual(Helper.makeClientState(c1State.userId, c1State.clientId, "ONLINE"));
          expect(ret[2][c2State.clientId]).toEqual(Helper.makeClientState(c2State.userId, c2State.clientId, "ONLINE"));
          expect(ret[3][c1State.clientId]).toEqual(Helper.makeClientState(c1State.userId, c1State.clientId, "ONLINE"));
          expect(ret[3][c2State.clientId]).toEqual(Helper.makeClientState(c2State.userId, c2State.clientId, "ONLINE"));
          return Promise.all([ c1.logout(), c2.logout() ]);
        }).then(done).catch(Helper.errHandler);
      }
    }
function(arr, info) {
      if (typeof arr !== "undefined") {
        arr.push(info);
      }
      if (!triggered &&
          seeBoth(c1ProfileEvts, "userId") && seeBoth(c2ProfileEvts, "userId") &&
          seeBoth(c1StateEvts, "clientId") && seeBoth(c2StateEvts, "clientId")) {
        triggered = true;
        Promise.all([ c1.getUsers(), c2.getUsers(), c1.getClients(), c2.getClients() ]).then(function(ret) {
          expect(ret[0][c1State.userId]).toEqual(Helper.makeUserProfile(c1State.userId));
          expect(ret[0][c2State.userId]).toEqual(Helper.makeUserProfile(c2State.userId));
          expect(ret[1][c1State.userId]).toEqual(Helper.makeUserProfile(c1State.userId));
          expect(ret[1][c2State.userId]).toEqual(Helper.makeUserProfile(c2State.userId));
          expect(ret[2][c1State.clientId]).toEqual(Helper.makeClientState(c1State.userId, c1State.clientId, "ONLINE"));
          expect(ret[2][c2State.clientId]).toEqual(Helper.makeClientState(c2State.userId, c2State.clientId, "ONLINE"));
          expect(ret[3][c1State.clientId]).toEqual(Helper.makeClientState(c1State.userId, c1State.clientId, "ONLINE"));
          expect(ret[3][c2State.clientId]).toEqual(Helper.makeClientState(c2State.userId, c2State.clientId, "ONLINE"));
          return Promise.all([ c1.logout(), c2.logout() ]);
        }).then(done).catch(Helper.errHandler);
      }
    }
function ( arr , info ) { if ( typeof arr !== "undefined" ) { arr . push ( info ) ; } if ( ! triggered && seeBoth ( c1ProfileEvts , "userId" ) && seeBoth ( c2ProfileEvts , "userId" ) && seeBoth ( c1StateEvts , "clientId" ) && seeBoth ( c2StateEvts , "clientId" ) ) { triggered = true ; Promise . all ( [ c1 . getUsers ( ) , c2 . getUsers ( ) , c1 . getClients ( ) , c2 . getClients ( ) ] ) . then ( function ( ret ) { expect ( ret [ 0 ] [ c1State . userId ] ) . toEqual ( Helper . makeUserProfile ( c1State . userId ) ) ; expect ( ret [ 0 ] [ c2State . userId ] ) . toEqual ( Helper . makeUserProfile ( c2State . userId ) ) ; expect ( ret [ 1 ] [ c1State . userId ] ) . toEqual ( Helper . makeUserProfile ( c1State . userId ) ) ; expect ( ret [ 1 ] [ c2State . userId ] ) . toEqual ( Helper . makeUserProfile ( c2State . userId ) ) ; expect ( ret [ 2 ] [ c1State . clientId ] ) . toEqual ( Helper . makeClientState ( c1State . userId , c1State . clientId , "ONLINE" ) ) ; expect ( ret [ 2 ] [ c2State . clientId ] ) . toEqual ( Helper . makeClientState ( c2State . userId , c2State . clientId , "ONLINE" ) ) ; expect ( ret [ 3 ] [ c1State . clientId ] ) . toEqual ( Helper . makeClientState ( c1State . userId , c1State . clientId , "ONLINE" ) ) ; expect ( ret [ 3 ] [ c2State . clientId ] ) . toEqual ( Helper . makeClientState ( c2State . userId , c2State . clientId , "ONLINE" ) ) ; return Promise . all ( [ c1 . logout ( ) , c2 . logout ( ) ] ) ; } ) . then ( done ) . catch ( Helper . errHandler ) ; } }
Triggered on every event, waiting until all necessary events are collected
Triggered on every event waiting until all necessary events are collected