整个课程和数据UI重新设计版本
This commit is contained in:
@@ -162,4 +162,51 @@ void main() {
|
||||
await executor.close();
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'repeated writes with cached analyses still persist later review progress',
|
||||
() async {
|
||||
final executor = NativeDatabase.memory();
|
||||
final store = LocalSnapshotStore.forTesting(executor);
|
||||
String snapshot(String dueAt) => jsonEncode({
|
||||
'onboardingComplete': true,
|
||||
'activeLessonId': 'a0-01',
|
||||
'attemptEvidence': [],
|
||||
'mastery': [],
|
||||
'reviews': [
|
||||
{
|
||||
'id': 'hello',
|
||||
'target': 'hello',
|
||||
'prompt': 'Say hello',
|
||||
'hint': '你好',
|
||||
'dueAt': dueAt,
|
||||
'skill': '口头回忆',
|
||||
},
|
||||
],
|
||||
'temporaryLexicon': [
|
||||
{'query': 'Hello', 'definition': '你好'},
|
||||
{'query': 'hello', 'definition': '你好'},
|
||||
],
|
||||
'sentenceAnalyses': [
|
||||
{
|
||||
'query': 'Nice to meet you.',
|
||||
'payload': {'translation': '很高兴认识你。'},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await store.write(snapshot('2026-09-18T08:00:00.000'));
|
||||
// A completed review moves the card to tomorrow; this write must land.
|
||||
await store.write(snapshot('2026-09-19T08:00:00.000'));
|
||||
|
||||
final restored =
|
||||
jsonDecode((await store.read())!) as Map<String, dynamic>;
|
||||
expect(
|
||||
(restored['reviews'] as List).single['dueAt'],
|
||||
'2026-09-19T08:00:00.000',
|
||||
);
|
||||
expect(restored['sentenceAnalyses'], hasLength(1));
|
||||
await executor.close();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user