function testAttach_WithObservers() {
  var promiseResolver = goog.Promise.withResolver();
  var scope = [j];

  var initialJobCount = sampleJobs.length;
  var additionalJobCount = 2;

  var jobDataGenerator = new lf.testing.hrSchema.JobDataGenerator(
      hr.db.getSchema());
  var newJobs = jobDataGenerator.generate(additionalJobCount);
  newJobs.forEach(function(job, index) {
    job.setId('SomeUniqueId' + index.toString());
  });

  var observeCallback = function(changeEvents) {
    assertEquals(
        initialJobCount + additionalJobCount,
        changeEvents.length);
    assertEquals(
        initialJobCount + additionalJobCount,
        changeEvents[0]['object'].length);

    promiseResolver.resolve();
  };

  var q = db.select().from(j);
  db.observe(q, observeCallback);

  tx.begin(scope).then(function() {
    // Adding a new job row.
    var q1 = db.insert().into(j).values([newJobs[0]]);
    return tx.attach(q1);
  }).then(function(results) {
    // Adding another new job row.
    var q2 = db.insert().into(j).values([newJobs[1]]);
    return tx.attach(q2);
  }).then(function() {
    return tx.commit();
  }, function(e) {
    promiseResolver.reject(e);
  });
  return promiseResolver.promise;
}
Tests the case where an attached query modifiess the results of an observed
query and ensures that observers are triggered.
@return {!IThenable}