mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
Applied consistent code formatting across all packages using \$ melos format
└> dart format .
└> RUNNING (in 8 packages)
--------------------------------------------------------------------------------
benchmark_di:
Formatted 18 files (0 changed) in 0.30 seconds.
benchmark_di: SUCCESS
--------------------------------------------------------------------------------
cherrypick:
Formatted 24 files (0 changed) in 0.34 seconds.
cherrypick: SUCCESS
--------------------------------------------------------------------------------
cherrypick_annotations:
Formatted 11 files (0 changed) in 0.14 seconds.
cherrypick_annotations: SUCCESS
--------------------------------------------------------------------------------
cherrypick_flutter:
Formatted 3 files (0 changed) in 0.15 seconds.
cherrypick_flutter: SUCCESS
--------------------------------------------------------------------------------
cherrypick_generator:
Formatted 17 files (0 changed) in 0.27 seconds.
cherrypick_generator: SUCCESS
--------------------------------------------------------------------------------
client_app:
Formatted 4 files (0 changed) in 0.14 seconds.
client_app: SUCCESS
--------------------------------------------------------------------------------
postly:
Formatted lib/router/app_router.gr.dart
Formatted 23 files (1 changed) in 0.33 seconds.
postly: SUCCESS
--------------------------------------------------------------------------------
talker_cherrypick_logger:
Formatted 4 files (0 changed) in 0.18 seconds.
talker_cherrypick_logger: SUCCESS
--------------------------------------------------------------------------------
$ melos format
└> dart format .
└> SUCCESS. No functional or logic changes included.
48 lines
1.5 KiB
Dart
48 lines
1.5 KiB
Dart
import 'package:test/test.dart';
|
|
import 'package:talker/talker.dart';
|
|
import 'package:talker_cherrypick_logger/talker_cherrypick_logger.dart';
|
|
|
|
void main() {
|
|
group('TalkerCherryPickObserver', () {
|
|
late Talker talker;
|
|
late TalkerCherryPickObserver observer;
|
|
|
|
setUp(() {
|
|
talker = Talker();
|
|
observer = TalkerCherryPickObserver(talker);
|
|
});
|
|
|
|
test('onInstanceRequested logs info', () {
|
|
observer.onInstanceRequested('A', String, scopeName: 'test');
|
|
final log = talker.history.last;
|
|
expect(log.message,
|
|
contains('[request][CherryPick] A — String (scope: test)'));
|
|
});
|
|
|
|
test('onCycleDetected logs warning', () {
|
|
observer.onCycleDetected(['A', 'B'], scopeName: 's');
|
|
final log = talker.history.last;
|
|
expect(log.message, contains('[cycle][CherryPick] Detected'));
|
|
//expect(log.level, TalkerLogLevel.warning);
|
|
});
|
|
|
|
test('onError calls handle', () {
|
|
final error = Exception('fail');
|
|
final stack = StackTrace.current;
|
|
observer.onError('Oops', error, stack);
|
|
final log = talker.history.last;
|
|
expect(log.message, contains('[error][CherryPick] Oops'));
|
|
expect(log.exception, error);
|
|
expect(log.stackTrace, stack);
|
|
});
|
|
|
|
test('onDiagnostic logs verbose', () {
|
|
observer.onDiagnostic('hello', details: 123);
|
|
final log = talker.history.last;
|
|
//expect(log.level, TalkerLogLevel.verbose);
|
|
expect(log.message, contains('hello'));
|
|
expect(log.message, contains('123'));
|
|
});
|
|
});
|
|
}
|