src/tests/user_sampling_channel_test.js
/**
 * Generate 1,000 random ids and verify that they're all rejected when the
 * sample rate is set to 0.
 */
Generate 1,000 random ids and verify that they're all rejected when the
sample rate is set to 0.
Generate 1 000 random ids and verify that they ' re all rejected when the sample rate is set to 0 .
function testSend_withRandomIds_sampleRate0() {
  var settings = new analytics.testing.TestSettings();
  settings.setSampleRate(0);
  for (var i = 0; i < 1000; i++) {
    var cid = analytics.internal.Identifier.generateUuid();
    var params = new analytics.ParameterMap();
    params.set(analytics.internal.Parameters.CLIENT_ID, cid);
    var delegate = new analytics.testing.TestChannel();
    var channel =
        new analytics.internal.UserSamplingChannel(settings, delegate);
    channel.send(analytics.HitTypes.APPVIEW, params);
    assertFalse('All hits should be reject when sample rate is 100',
        delegate.hitWasSent(params));
  }
}
function testSend_withRandomIds_sampleRate0 ( ) { var settings = new analytics . testing . TestSettings ( ) ; settings . setSampleRate ( 0 ) ; for ( var i = 0 ; i < 1000 ; i ++ ) { var cid = analytics . internal . Identifier . generateUuid ( ) ; var params = new analytics . ParameterMap ( ) ; params . set ( analytics . internal . Parameters . CLIENT_ID , cid ) ; var delegate = new analytics . testing . TestChannel ( ) ; var channel = new analytics . internal . UserSamplingChannel ( settings , delegate ) ; channel . send ( analytics . HitTypes . APPVIEW , params ) ; assertFalse ( 'All hits should be reject when sample rate is 100' , delegate . hitWasSent ( params ) ) ; } }
Generate 1,000 random ids and verify that they're all rejected when the
 sample rate is set to 0.
Generate 1 000 random ids and verify that they ' re all rejected when the sample rate is set to 0 .