import 'package:pipe/pipe.dart'; import 'package:test/test.dart'; void main() { test('omits the by-type clause when the app declares no providers', () { // Before this was fixed, a project with notifiers but no provider // declarations rendered `... notify path. Provider declarations by type: .` // - a dangling colon and full stop that reads as a truncated sentence // rather than as "this app declares none". Observed on word_alive. final note = providerRuleNote( notifiers: 10, consumed: 0, mutators: 36, byKind: const {}, ); expect(note, isNot(contains('by type'))); expect(note, isNot(contains(': .'))); expect(note, endsWith('notify path.')); }); test('lists declaration kinds, most common first, when there are some', () { final note = providerRuleNote( notifiers: 8, consumed: 6, mutators: 30, byKind: const {'ChangeNotifierProvider': 6, 'Provider': 107}, ); expect( note, endsWith( 'Provider declarations by type: Provider 107, ' 'ChangeNotifierProvider 6.', ), ); }); }