dart-sdk/pkg/telemetry/test/utils_test.dart
Devon Carew b8f4b252ef move pkg/telemetry to using package:lints
Change-Id: I75130cc8d5964ef0f95a672858da8bbce8ffd78c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200520
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-05-19 16:26:42 +00:00

24 lines
754 B
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:telemetry/src/utils.dart';
import 'package:test/test.dart';
void main() {
group('ThrottlingBucket', () {
test('can send', () {
ThrottlingBucket bucket = ThrottlingBucket(10, Duration(minutes: 1));
expect(bucket.removeDrop(), true);
});
test("doesn't send too many", () {
ThrottlingBucket bucket = ThrottlingBucket(10, Duration(minutes: 1));
for (int i = 0; i < 10; i++) {
expect(bucket.removeDrop(), true);
}
expect(bucket.removeDrop(), false);
});
});
}