import 'package:flutter_test/flutter_test.dart'; import 'package:life_helper/domain/models/habit.dart'; import 'package:life_helper/domain/rules/active_habit_quota.dart'; void main() { test('build allows up to 3', () { expect( judgeActiveHabitQuota(type: HabitType.build, currentActiveCount: 2).allowed, true, ); expect( judgeActiveHabitQuota(type: HabitType.build, currentActiveCount: 3).allowed, false, ); }); test('break allows only 1', () { expect( judgeActiveHabitQuota(type: HabitType.breakHabit, currentActiveCount: 0) .allowed, true, ); expect( judgeActiveHabitQuota(type: HabitType.breakHabit, currentActiveCount: 1) .allowed, false, ); }); test('reason describes the limit when blocked', () { final r = judgeActiveHabitQuota( type: HabitType.build, currentActiveCount: 3); expect(r.reason, contains('3')); final br = judgeActiveHabitQuota( type: HabitType.breakHabit, currentActiveCount: 1); expect(br.reason, contains('1')); }); }