|
1 | 1 | import 'package:bible_feed/model/book_key_externaliser.dart'; |
2 | 2 | import 'package:flutter_test/flutter_test.dart'; |
| 3 | +import 'package:bible_feed/model/reading_lists.dart'; |
| 4 | + |
| 5 | +class ProdReadingListsModule extends ReadingListsModule {} |
3 | 6 |
|
4 | 7 | void main() { |
5 | 8 | void runTest(BookKeyExternaliser testee, Map<String, String> expectedMappings) { |
| 9 | + final defaultMappings = <String, String>{}; |
| 10 | + for (final readingList in ProdReadingListsModule().readingLists) { |
| 11 | + for (final book in readingList) { |
| 12 | + defaultMappings[book.key] = book.key; |
| 13 | + } |
| 14 | + } |
| 15 | + |
| 16 | + final mergedMappings = Map<String, String>.from(defaultMappings); |
| 17 | + mergedMappings.addAll(expectedMappings.map((k, v) => MapEntry(k, v))); |
| 18 | + |
6 | 19 | group(testee.runtimeType.toString(), () { |
7 | | - expectedMappings.forEach((from, to) { |
8 | | - test('getExternalBookKey "$from" should return "$to"', () { |
| 20 | + mergedMappings.forEach((from, to) { |
| 21 | + test('${testee.name}.getExternalBookKey "$from" should return "$to"', () { |
9 | 22 | expect(testee.getExternalBookKey(from), to); |
10 | 23 | }); |
11 | 24 | }); |
12 | | - |
13 | | - test('getExternalBookKey returns original key for unknown keys', () { |
14 | | - expect(testee.getExternalBookKey('unknown'), 'unknown'); |
15 | | - }); |
16 | 25 | }); |
17 | 26 | } |
18 | 27 |
|
|
0 commit comments