@@ -1141,12 +1141,14 @@ void main() {
11411141 group ('selectStudyRecommendation' , () {
11421142 final now = DateTime (2026 , 10 , 11 , 12 );
11431143
1144- AudioItem material (String id, String name) => AudioItem (
1145- id: id,
1146- name: name,
1147- audioPath: 'materials/$id .mp3' ,
1148- addedDate: now,
1149- );
1144+ AudioItem material (String id, String name, {bool hasSubtitle = true }) =>
1145+ AudioItem (
1146+ id: id,
1147+ name: name,
1148+ audioPath: 'materials/$id .mp3' ,
1149+ addedDate: now,
1150+ transcriptSource: hasSubtitle ? TranscriptSource .local : null ,
1151+ );
11501152
11511153 RecentCompletion completion (String audioId, DateTime completedAt) =>
11521154 RecentCompletion (
@@ -1201,6 +1203,24 @@ void main() {
12011203 expect (result? .id, 'planned' );
12021204 });
12031205
1206+ test ('没有字幕的材料不推荐,即使它是最近学习的材料' , () {
1207+ final result = selectStudyRecommendation (
1208+ materials: [
1209+ material ('no-subtitle' , 'No Subtitle' , hasSubtitle: false ),
1210+ material ('with-subtitle' , 'With Subtitle' ),
1211+ ],
1212+ progressByAudioId: {},
1213+ playbackSavedAtByAudioId: {
1214+ 'no-subtitle' : now.add (const Duration (hours: 5 )),
1215+ 'with-subtitle' : now.add (const Duration (hours: 1 )),
1216+ },
1217+ latestCompletionAtByAudioId: const {},
1218+ recentCompletions: const [],
1219+ );
1220+
1221+ expect (result? .id, 'with-subtitle' );
1222+ });
1223+
12041224 test ('待解锁的复习材料不推荐,即使它是最近学习的材料' , () {
12051225 final result = selectStudyRecommendation (
12061226 materials: [material ('locked' , 'Locked' ), material ('free' , 'Free' )],
0 commit comments