feat: add exam score management
Some checks failed
CI 检查 / lint (pull_request) Has been cancelled
CI 检查 / typecheck (pull_request) Has been cancelled
CI 检查 / test (pull_request) Has been cancelled

This commit is contained in:
2026-07-21 16:04:17 +08:00
parent 37ef6f9dd7
commit cbc04fea4f
27 changed files with 1061 additions and 16 deletions

View File

@@ -67,6 +67,22 @@ describe('ArchiveService — resource and relationship boundaries', () => {
expect(exam.save).not.toHaveBeenCalled();
});
it('keeps exam-management scores read-only in the student archive', async () => {
const exam = {
findOne: jest.fn().mockResolvedValue({ id: 3, studentId: 7, examId: 8 }),
save: jest.fn(),
update: jest.fn(),
};
const service = createService({ exam });
await expect(service.updateExamScore(3, { score: 95 })).rejects.toBeInstanceOf(
BadRequestException,
);
await expect(service.deleteExamScore(3)).rejects.toBeInstanceOf(BadRequestException);
expect(exam.save).not.toHaveBeenCalled();
expect(exam.update).not.toHaveBeenCalled();
});
it('rejects a missing attachment upload before writing to disk', async () => {
const service = createService({ student: { findOne: jest.fn() } });
await expect(service.addAttachment(7, undefined as never, 'other')).rejects.toBeInstanceOf(