chore: ai, public course and other ui improvements

This commit is contained in:
Rotimi Best
2026-05-09 06:05:03 +01:00
parent 5717dd8004
commit c31ad63955
318 changed files with 20668 additions and 4788 deletions
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest';
import {
AUTO_GRADABLE_QUESTION_TYPE_IDS,
QUESTION_TYPE_BY_KEY,
QUESTION_TYPE_ID_TO_KEY,
QUESTION_TYPE_IDS,
@@ -11,6 +12,7 @@ import {
getQuestionTypeByTypename,
getQuestionTypeId,
isAutoGradableQuestionType,
isAutoGradableQuestionTypeId,
requiresManualGrading,
supportsPartialCredit
} from '../src';
@@ -127,6 +129,14 @@ const EXPECTED_REGISTRY = [
autoGradable: true,
supportsPartialCredit: false,
manualGradingRequired: false
},
{
key: QUESTION_TYPE_KEY.VIDEO_RECORDING,
typename: 'VIDEO_RECORDING',
id: 15,
autoGradable: false,
supportsPartialCredit: false,
manualGradingRequired: true
}
] as const;
@@ -170,4 +180,17 @@ describe('question type registry', () => {
expect(getQuestionTypeByTypename('UNKNOWN')).toBeUndefined();
expect(getQuestionTypeById(999)).toBeUndefined();
});
it('AUTO_GRADABLE_QUESTION_TYPE_IDS matches registry flag by id', () => {
const expectedIds = QUESTION_TYPE_REGISTRY.filter((entry) => entry.autoGradable).map((entry) => entry.id);
expect(AUTO_GRADABLE_QUESTION_TYPE_IDS).toEqual(expectedIds);
});
it('isAutoGradableQuestionTypeId agrees with isAutoGradableQuestionType for every registry entry', () => {
for (const entry of QUESTION_TYPE_REGISTRY) {
expect(isAutoGradableQuestionTypeId(entry.id)).toBe(entry.autoGradable);
expect(isAutoGradableQuestionTypeId(entry.id)).toBe(isAutoGradableQuestionType(entry.key));
}
expect(isAutoGradableQuestionTypeId(9999)).toBe(false);
});
});