Files
openmaic/OpenMAIC/tests/pbl/v2/instructor-intro.test.ts
2026-08-16 14:58:47 +08:00

27 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 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();
});
});