src/tests/extras/filters/event_labeler_builder_test.js
/**
 * Tests that a range bounds labeler produces the correct range labels for
 * the given hit value.
 */
Tests that a range bounds labeler produces the correct range labels for
the given hit value.
Tests that a range bounds labeler produces the correct range labels for the given hit value .
function testRangeBoundsLabeler() {
  var rightBounds = [10, 50, 100, 250, 500, 1000];
  var labeler = new analytics.filters.EventLabelerBuilder().
      rangeBounds(rightBounds).
      build();
  checkLabelerHit(labeler, '<= 0', -230);
  checkLabelerHit(labeler, '<= 0', -230);
  checkLabelerHit(labeler, '<= 0', 0);
  checkLabelerHit(labeler, '1-10', 1);
  checkLabelerHit(labeler, '1-10', 3);
  checkLabelerHit(labeler, '1-10', 10);
  checkLabelerHit(labeler, '11-50', 11);
  checkLabelerHit(labeler, '11-50', 33);
  checkLabelerHit(labeler, '11-50', 50);
  checkLabelerHit(labeler, '51-100', 51);
  checkLabelerHit(labeler, '51-100', 75);
  checkLabelerHit(labeler, '51-100', 100);
  checkLabelerHit(labeler, '101-250', 101);
  checkLabelerHit(labeler, '101-250', 186);
  checkLabelerHit(labeler, '101-250', 250);
  checkLabelerHit(labeler, '251-500', 251);
  checkLabelerHit(labeler, '251-500', 386);
  checkLabelerHit(labeler, '251-500', 500);
  checkLabelerHit(labeler, '501-1000', 501);
  checkLabelerHit(labeler, '501-1000', 750);
  checkLabelerHit(labeler, '501-1000', 1000);
  checkLabelerHit(labeler, '1001+', 1001);
  checkLabelerHit(labeler, '1001+', 1500);
  checkLabelerHit(labeler, '1001+', 2000);
}
function testRangeBoundsLabeler ( ) { var rightBounds = [ 10 , 50 , 100 , 250 , 500 , 1000 ] ; var labeler = new analytics . filters . EventLabelerBuilder ( ) . rangeBounds ( rightBounds ) . build ( ) ; checkLabelerHit ( labeler , '<= 0' , - 230 ) ; checkLabelerHit ( labeler , '<= 0' , - 230 ) ; checkLabelerHit ( labeler , '<= 0' , 0 ) ; checkLabelerHit ( labeler , '1-10' , 1 ) ; checkLabelerHit ( labeler , '1-10' , 3 ) ; checkLabelerHit ( labeler , '1-10' , 10 ) ; checkLabelerHit ( labeler , '11-50' , 11 ) ; checkLabelerHit ( labeler , '11-50' , 33 ) ; checkLabelerHit ( labeler , '11-50' , 50 ) ; checkLabelerHit ( labeler , '51-100' , 51 ) ; checkLabelerHit ( labeler , '51-100' , 75 ) ; checkLabelerHit ( labeler , '51-100' , 100 ) ; checkLabelerHit ( labeler , '101-250' , 101 ) ; checkLabelerHit ( labeler , '101-250' , 186 ) ; checkLabelerHit ( labeler , '101-250' , 250 ) ; checkLabelerHit ( labeler , '251-500' , 251 ) ; checkLabelerHit ( labeler , '251-500' , 386 ) ; checkLabelerHit ( labeler , '251-500' , 500 ) ; checkLabelerHit ( labeler , '501-1000' , 501 ) ; checkLabelerHit ( labeler , '501-1000' , 750 ) ; checkLabelerHit ( labeler , '501-1000' , 1000 ) ; checkLabelerHit ( labeler , '1001+' , 1001 ) ; checkLabelerHit ( labeler , '1001+' , 1500 ) ; checkLabelerHit ( labeler , '1001+' , 2000 ) ; }
Tests that a range bounds labeler produces the correct range labels for
 the given hit value.
Tests that a range bounds labeler produces the correct range labels for the given hit value .