chore: establish learning module baseline

This commit is contained in:
inman committed 2026-08-16 14:58:47 +08:00
commit 2d04197f3f
2409 files changed
+533050

No files matched your search

@@ -0,0 +1,26 @@
/**
* Tests for the learner-facing instructor intro selector (avatar hover title).
*
* Locks the "show curated description, fall back to nothing when blank/missing"
* rule. The avatar then renders `agentIntro ?? agentName` as a native `title`,
* so old projects (which may already carry a description) and new projects both
* surface the intro, and the cursor never changes.
*/
import { describe, expect, it } from 'vitest';
import { instructorIntroText } from '@/components/scene-renderers/pbl/v2/instructor-intro';
describe('instructorIntroText', () => {
it('returns the trimmed description when present', () => {
expect(
instructorIntroText({ description: ' 我是你的向导 Aki,全程陪你做完这个项目。 ' }),
).toBe('我是你的向导 Aki,全程陪你做完这个项目。');
});
it('returns undefined for blank / whitespace / missing description', () => {
expect(instructorIntroText({ description: ' ' })).toBeUndefined();
expect(instructorIntroText({ description: '' })).toBeUndefined();
expect(instructorIntroText({})).toBeUndefined();
expect(instructorIntroText(undefined)).toBeUndefined();
expect(instructorIntroText(null)).toBeUndefined();
});
});