Files
sharedinbox/test/unit/mailbox_model_test.dart
T
Thomas GüttlerandClaude Sonnet 4.6 24482c7e4b Push coverage to 87%: remove 4 screens from excluded, add nav/search tests
- run_unit_tests.sh and CI now run unit + widget tests together for coverage
- Removed account_list, email_list, mailbox_list, settings screens from
  _excluded (all ≥70% when measured with widget tests)
- Added tests: mailbox tile tap, account tile tap, empty-state button,
  settings Remove confirmation, email search submit/results/sync/edit
- FakeEmailRepository accepts searchResults for testing search paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 15:29:40 +02:00

68 lines
1.7 KiB
Dart

import 'package:test/test.dart';
import 'package:sharedinbox/core/models/mailbox.dart';
// Import the abstract interface so it appears in coverage.
import 'package:sharedinbox/core/repositories/mailbox_repository.dart'; // ignore: unused_import
void main() {
group('Mailbox', () {
const mailbox = Mailbox(
id: 'a1:INBOX',
accountId: 'a1',
path: 'INBOX',
name: 'INBOX',
unreadCount: 3,
totalCount: 10,
);
test('stores all fields', () {
expect(mailbox.id, 'a1:INBOX');
expect(mailbox.accountId, 'a1');
expect(mailbox.path, 'INBOX');
expect(mailbox.name, 'INBOX');
expect(mailbox.unreadCount, 3);
expect(mailbox.totalCount, 10);
});
test('sub-folder path is stored verbatim', () {
const sub = Mailbox(
id: 'a1:INBOX/Work',
accountId: 'a1',
path: 'INBOX/Work',
name: 'Work',
unreadCount: 0,
totalCount: 5,
);
expect(sub.path, 'INBOX/Work');
expect(sub.name, 'Work');
});
test('runtime construction stores all fields', () {
// Non-const construction so the constructor is instrumented for coverage.
// ignore: prefer_const_constructors
final mb = Mailbox(
id: 'a1:INBOX',
accountId: 'a1',
path: 'INBOX',
name: 'INBOX',
unreadCount: 0,
totalCount: 0,
);
expect(mb.id, 'a1:INBOX');
});
test('zero counts are valid', () {
const empty = Mailbox(
id: 'a1:Trash',
accountId: 'a1',
path: 'Trash',
name: 'Trash',
unreadCount: 0,
totalCount: 0,
);
expect(empty.unreadCount, 0);
expect(empty.totalCount, 0);
});
});
}