-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstring_formatting_helper_test.dart
More file actions
47 lines (39 loc) · 1.46 KB
/
Copy pathstring_formatting_helper_test.dart
File metadata and controls
47 lines (39 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import 'package:cambridge_beer_festival/utils/utils.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('StringFormattingHelper', () {
group('capitalizeFirst', () {
test('uppercases the first character', () {
expect(StringFormattingHelper.capitalizeFirst('cask'), 'Cask');
expect(StringFormattingHelper.capitalizeFirst('keg'), 'Keg');
});
test('leaves the remaining characters untouched', () {
expect(
StringFormattingHelper.capitalizeFirst('bag in box'),
'Bag in box',
);
});
test('is a no-op for an already capitalised string', () {
expect(StringFormattingHelper.capitalizeFirst('Cask'), 'Cask');
});
test('returns an empty string unchanged', () {
expect(StringFormattingHelper.capitalizeFirst(''), '');
});
test('handles a single character', () {
expect(StringFormattingHelper.capitalizeFirst('a'), 'A');
});
});
group('drinkCountLabel', () {
test('pluralises zero', () {
expect(StringFormattingHelper.drinkCountLabel(0), '0 drinks');
});
test('uses the singular for exactly one', () {
expect(StringFormattingHelper.drinkCountLabel(1), '1 drink');
});
test('pluralises counts above one', () {
expect(StringFormattingHelper.drinkCountLabel(2), '2 drinks');
expect(StringFormattingHelper.drinkCountLabel(147), '147 drinks');
});
});
});
}