Frontend: - Replace Next.js with Vite + React + TypeScript - Add new component architecture (app-shell, sidebar, dashboard modules) - Implement product modules: FRAME, safety protocols, walkthrough checkin, campus/staff attendance, personality quiz, sign language, classroom timer - Add shadcn/ui component library with Tailwind CSS - Remove legacy generated components, stores, and pages Backend: - Add product migrations: frame_entries, user_progress, safety_quiz_results, walkthrough_checkins, communication_events, personality_quiz_results, campus_attendance_config/summaries, staff_attendance_records, content_catalog - Add corresponding models, services, and routes - Implement cookie-based auth with refresh token rotation - Add content catalog seeder with product content - Migrate to ESLint flat config - Switch from yarn to npm Infrastructure: - Update .gitignore for new tooling - Add project documentation (CLAUDE.md, docs/) - Remove deprecated config files and yarn.lock Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
toLearnedSignIds,
|
|
toZoneColor,
|
|
} from '@/business/user-progress/mappers';
|
|
import type { UserProgressDto } from '@/shared/types/userProgress';
|
|
|
|
function createProgress(overrides: Partial<UserProgressDto> = {}): UserProgressDto {
|
|
return {
|
|
id: 'progress-1',
|
|
progress_type: 'sign_learned',
|
|
item_id: 'hello',
|
|
value: null,
|
|
score: null,
|
|
metadata: null,
|
|
organizationId: 'org-1',
|
|
campusId: 'campus-1',
|
|
userId: 'user-1',
|
|
createdAt: '2026-06-08T12:00:00.000Z',
|
|
updatedAt: '2026-06-08T12:00:00.000Z',
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe('user progress mappers', () => {
|
|
it('maps learned sign progress rows to a unique id set', () => {
|
|
const learnedSignIds = toLearnedSignIds([
|
|
createProgress({ id: '1', item_id: 'hello' }),
|
|
createProgress({ id: '2', item_id: 'help' }),
|
|
createProgress({ id: '3', item_id: 'hello' }),
|
|
]);
|
|
|
|
expect([...learnedSignIds].sort()).toEqual(['hello', 'help']);
|
|
});
|
|
|
|
it('normalizes valid zone colors and rejects invalid values', () => {
|
|
expect(toZoneColor('blue')).toBe('blue');
|
|
expect(toZoneColor('green')).toBe('green');
|
|
expect(toZoneColor('yellow')).toBe('yellow');
|
|
expect(toZoneColor('red')).toBe('red');
|
|
expect(toZoneColor('purple')).toBeNull();
|
|
expect(toZoneColor(null)).toBeNull();
|
|
});
|
|
});
|