fix(archive): align aggregate result field

This commit is contained in:
2026-07-13 12:04:47 +08:00
parent 2874ab7bee
commit dfd3cf6772
2 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
import { ArchiveService } from './archive.service';
describe('ArchiveService.getProfile', () => {
it('returns the admission archive under the public result field', async () => {
const student = { id: 7, name: '测试学生' };
const result = {
id: 3,
studentId: 7,
cultureFinalScore: 450,
admittedCollege: '测试学院',
};
const studentRepo = { findOne: jest.fn().mockResolvedValue(student) };
const profileRepo = { findOne: jest.fn().mockResolvedValue(null) };
const enrollmentRepo = { find: jest.fn().mockResolvedValue([]) };
const examScoreRepo = { find: jest.fn().mockResolvedValue([]) };
const learningRecordRepo = { find: jest.fn().mockResolvedValue([]) };
const resultRepo = { findOne: jest.fn().mockResolvedValue(result) };
const attachmentRepo = { find: jest.fn().mockResolvedValue([]) };
const service = new ArchiveService(
studentRepo as never,
profileRepo as never,
enrollmentRepo as never,
examScoreRepo as never,
learningRecordRepo as never,
resultRepo as never,
attachmentRepo as never,
{} as never,
);
const response = await service.getProfile(7);
expect(response).toMatchObject({ student, result });
expect(response).not.toHaveProperty('resultArchive');
});
});

View File

@@ -76,7 +76,7 @@ export class ArchiveService {
enrollments, enrollments,
examScores, examScores,
learningRecords, learningRecords,
resultArchive, result: resultArchive,
attachments, attachments,
}; };
} }