dist/tgi-store-json-file.spec.js
function stoogeRetrieved(model, error) {
          if (typeof error != 'undefined') {
            callback(error);
            return;
          }
          self.stoogesRetrieved.push(model);
          if (self.stoogesRetrieved.length == 3) {
            self.shouldBeTrue(true,'here');
            // Now we have stored and retrieved (via IDs into new objects).  So verify the stooges made it
            self.shouldBeTrue(self.stoogesRetrieved[0] !== self.moe && // Make sure not a reference but a copy
            self.stoogesRetrieved[0] !== self.larry && self.stoogesRetrieved[0] !== self.shemp,'copy');
            var s = []; // get list of names to see if all stooges made it
            for (var i = 0; i < 3; i++) s.push(self.stoogesRetrieved[i].get('name'));
            self.log(s);
            self.shouldBeTrue(contains(s, 'Moe') && contains(s, 'Larry') && contains(s, 'Shemp'));
            // Replace Shemp with Curly
            var didPutCurly = false;
            for (i = 0; i < 3; i++) {
              if (self.stoogesRetrieved[i].get('name') == 'Shemp') {
                didPutCurly = true;
                self.stoogesRetrieved[i].set('name', 'Curly');
                try {
                  spec.integrationStore.putModel(self.stoogesRetrieved[i], stoogeChanged);
                }
                catch (err) {
                  callback(err);
                }
              }
            }
            if (!didPutCurly) {
              callback(Error("Can't find Shemp!"));
            }
          }
        }
function stoogeRetrieved(model, error) {
          if (typeof error != 'undefined') {
            callback(error);
            return;
          }
          self.stoogesRetrieved.push(model);
          if (self.stoogesRetrieved.length == 3) {
            self.shouldBeTrue(true,'here');
            // Now we have stored and retrieved (via IDs into new objects).  So verify the stooges made it
            self.shouldBeTrue(self.stoogesRetrieved[0] !== self.moe && // Make sure not a reference but a copy
            self.stoogesRetrieved[0] !== self.larry && self.stoogesRetrieved[0] !== self.shemp,'copy');
            var s = []; // get list of names to see if all stooges made it
            for (var i = 0; i < 3; i++) s.push(self.stoogesRetrieved[i].get('name'));
            self.log(s);
            self.shouldBeTrue(contains(s, 'Moe') && contains(s, 'Larry') && contains(s, 'Shemp'));
            // Replace Shemp with Curly
            var didPutCurly = false;
            for (i = 0; i < 3; i++) {
              if (self.stoogesRetrieved[i].get('name') == 'Shemp') {
                didPutCurly = true;
                self.stoogesRetrieved[i].set('name', 'Curly');
                try {
                  spec.integrationStore.putModel(self.stoogesRetrieved[i], stoogeChanged);
                }
                catch (err) {
                  callback(err);
                }
              }
            }
            if (!didPutCurly) {
              callback(Error("Can't find Shemp!"));
            }
          }
        }
function stoogeRetrieved ( model , error ) { if ( typeof error != 'undefined' ) { callback ( error ) ; return ; } self . stoogesRetrieved . push ( model ) ; if ( self . stoogesRetrieved . length == 3 ) { self . shouldBeTrue ( true , 'here' ) ; // Now we have stored and retrieved (via IDs into new objects).  So verify the stooges made it self . shouldBeTrue ( self . stoogesRetrieved [ 0 ] !== self . moe && // Make sure not a reference but a copy self . stoogesRetrieved [ 0 ] !== self . larry && self . stoogesRetrieved [ 0 ] !== self . shemp , 'copy' ) ; var s = [ ] ; // get list of names to see if all stooges made it for ( var i = 0 ; i < 3 ; i ++ ) s . push ( self . stoogesRetrieved [ i ] . get ( 'name' ) ) ; self . log ( s ) ; self . shouldBeTrue ( contains ( s , 'Moe' ) && contains ( s , 'Larry' ) && contains ( s , 'Shemp' ) ) ; // Replace Shemp with Curly var didPutCurly = false ; for ( i = 0 ; i < 3 ; i ++ ) { if ( self . stoogesRetrieved [ i ] . get ( 'name' ) == 'Shemp' ) { didPutCurly = true ; self . stoogesRetrieved [ i ] . set ( 'name' , 'Curly' ) ; try { spec . integrationStore . putModel ( self . stoogesRetrieved [ i ] , stoogeChanged ) ; } catch ( err ) { callback ( err ) ; } } } if ( ! didPutCurly ) { callback ( Error ( "Can't find Shemp!" ) ) ; } } }
callback after retrieving stored stooges
callback after retrieving stored stooges