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 attendanceRepo = { 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,
      attendanceRepo as never,
      {} as never,
    );

    const response = await service.getProfile(7);

    expect(response).toMatchObject({ student, result, attendances: [] });
    expect(response).not.toHaveProperty('resultArchive');
  });
});
