fix(archive): align aggregate result field
This commit is contained in:
37
apps/server/src/archive/archive.service.spec.ts
Normal file
37
apps/server/src/archive/archive.service.spec.ts
Normal 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');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -76,7 +76,7 @@ export class ArchiveService {
|
|||||||
enrollments,
|
enrollments,
|
||||||
examScores,
|
examScores,
|
||||||
learningRecords,
|
learningRecords,
|
||||||
resultArchive,
|
result: resultArchive,
|
||||||
attachments,
|
attachments,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user