feat(proj): init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:please_pay_me/core/format/formatters.dart';
|
||||
|
||||
import 'support/test_setup.dart';
|
||||
|
||||
void main() {
|
||||
setUpAll(setUpTestEnvironment);
|
||||
|
||||
test('money uses Russian grouping and the ruble sign', () {
|
||||
expect(formatMoney(1234.5), '1 234,50 ₽');
|
||||
expect(formatMoney(250, compact: true), '250 ₽');
|
||||
});
|
||||
|
||||
test('expenses are rendered as a deduction', () {
|
||||
expect(formatSignedMoney(250), '−250,00 ₽');
|
||||
expect(formatSignedMoney(-250), '+250,00 ₽');
|
||||
});
|
||||
|
||||
test('plural follows Russian rules', () {
|
||||
expect(plural(1, 'день', 'дня', 'дней'), '1 день');
|
||||
expect(plural(3, 'день', 'дня', 'дней'), '3 дня');
|
||||
expect(plural(11, 'день', 'дня', 'дней'), '11 дней');
|
||||
expect(plural(21, 'день', 'дня', 'дней'), '21 день');
|
||||
});
|
||||
|
||||
test('relative day switches to a date beyond yesterday', () {
|
||||
final now = DateTime(2026, 9, 19);
|
||||
|
||||
expect(formatRelativeDay(now, now: now), 'Сегодня');
|
||||
expect(formatRelativeDay(DateTime(2026, 9, 18), now: now), 'Вчера');
|
||||
expect(formatRelativeDay(DateTime(2026, 9, 12), now: now), '12 сентября');
|
||||
});
|
||||
|
||||
test('days left is humanized', () {
|
||||
expect(formatDaysLeft(0), 'период завершён');
|
||||
expect(formatDaysLeft(5), 'осталось 5 дней');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user