refactor(core): simplify ai test cases (#13378)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Tests**
  * Updated test cases to use a new test asset describing AFFiNE.
* Adjusted assertions to check for "AFFiNE" in results instead of
previous keywords.
* Separated and refined the "Continue writing" test for clearer
validation.
  * Improved assertion messages for clarity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Wu Yue
2025-07-31 17:52:28 +08:00
committed by GitHub
parent 75cc9b432b
commit 826afc209e
2 changed files with 17 additions and 17 deletions

View File

@@ -530,27 +530,29 @@ The term **“CRDT”** was first introduced by Marc Shapiro, Nuno Preguiça, Ca
'Create headings', 'Create headings',
'Make it longer', 'Make it longer',
'Make it shorter', 'Make it shorter',
'Continue writing',
'Section Edit', 'Section Edit',
'Chat With AFFiNE AI', 'Chat With AFFiNE AI',
'Search With AFFiNE AI', 'Search With AFFiNE AI',
], ],
messages: [{ role: 'user' as const, content: TestAssets.SSOT }], messages: [{ role: 'user' as const, content: TestAssets.AFFiNE }],
verifier: (t: ExecutionContext<Tester>, result: string) => { verifier: (t: ExecutionContext<Tester>, result: string) => {
assertNotWrappedInCodeBlock(t, result); assertNotWrappedInCodeBlock(t, result);
const cleared = result.toLowerCase(); t.assert(result.includes('AFFiNE'), 'should include original keyword');
t.assert( },
cleared.includes('single source of truth') || type: 'text' as const,
/single.*source/.test(cleared) || },
cleared.includes('ssot'), {
'should include original keyword' promptName: ['Continue writing'],
); messages: [{ role: 'user' as const, content: TestAssets.AFFiNE }],
verifier: (t: ExecutionContext<Tester>, result: string) => {
assertNotWrappedInCodeBlock(t, result);
t.assert(result.length > 0, 'should not be empty');
}, },
type: 'text' as const, type: 'text' as const,
}, },
{ {
promptName: ['Brainstorm ideas about this', 'Brainstorm mindmap'], promptName: ['Brainstorm ideas about this', 'Brainstorm mindmap'],
messages: [{ role: 'user' as const, content: TestAssets.SSOT }], messages: [{ role: 'user' as const, content: TestAssets.AFFiNE }],
verifier: (t: ExecutionContext<Tester>, result: string) => { verifier: (t: ExecutionContext<Tester>, result: string) => {
assertNotWrappedInCodeBlock(t, result); assertNotWrappedInCodeBlock(t, result);
t.assert(checkMDList(result), 'should be a markdown list'); t.assert(checkMDList(result), 'should be a markdown list');
@@ -593,17 +595,13 @@ The term **“CRDT”** was first introduced by Marc Shapiro, Nuno Preguiça, Ca
messages: [ messages: [
{ {
role: 'user' as const, role: 'user' as const,
content: TestAssets.SSOT, content: TestAssets.AFFiNE,
params: { language: 'Simplified Chinese' }, params: { language: 'Simplified Chinese' },
}, },
], ],
verifier: (t: ExecutionContext<Tester>, result: string) => { verifier: (t: ExecutionContext<Tester>, result: string) => {
assertNotWrappedInCodeBlock(t, result); assertNotWrappedInCodeBlock(t, result);
const cleared = result.toLowerCase(); t.assert(result.includes('AFFiNE'), 'should include keyword');
t.assert(
cleared.includes('单一') || cleared.includes('SSOT'),
'explain code result should include keyword'
);
}, },
type: 'text' as const, type: 'text' as const,
}, },
@@ -625,7 +623,7 @@ The term **“CRDT”** was first introduced by Marc Shapiro, Nuno Preguiça, Ca
content.includes('classroom') || content.includes('classroom') ||
content.includes('school') || content.includes('school') ||
content.includes('sky'), content.includes('sky'),
'explain code result should include keyword' 'should include keyword'
); );
}, },
type: 'text' as const, type: 'text' as const,

File diff suppressed because one or more lines are too long