15 lines
707 B
TypeScript
15 lines
707 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { courseModuleCoursewareId } from '@/lib/course-framework/publish-identity';
|
|
|
|
describe('large-course public module identity', () => {
|
|
it('is stable and does not contain the mutable classroom id', () => {
|
|
expect(courseModuleCoursewareId('course-123', 2)).toBe('course_course-123_module_2');
|
|
expect(courseModuleCoursewareId('course-123', 2)).not.toContain('classroom-private-source');
|
|
});
|
|
|
|
it('rejects invalid course and module identities', () => {
|
|
expect(() => courseModuleCoursewareId('../course', 1)).toThrow('Invalid course id');
|
|
expect(() => courseModuleCoursewareId('course-123', 0)).toThrow('Invalid module index');
|
|
});
|
|
});
|