diff --git a/server/src/__tests__/entities.module.spec.ts b/server/src/__tests__/entities.module.spec.ts index 7c381058..b4f1f837 100644 --- a/server/src/__tests__/entities.module.spec.ts +++ b/server/src/__tests__/entities.module.spec.ts @@ -1,8 +1,6 @@ import { Test, TestingModule } from '@nestjs/testing'; import { EntitiesModule } from '../entities.module'; -import { BaseEntityModule } from '@shared/base-entity/base-entity.module'; -import { getMetadataArgsStorage, DataSource } from 'typeorm'; -import { TypeOrmModule, getDataSourceToken } from '@nestjs/typeorm'; +import { getMetadataArgsStorage } from 'typeorm'; // Mock BaseEntityModule jest.mock('@shared/base-entity/base-entity.module', () => { @@ -18,17 +16,11 @@ jest.mock('@shared/base-entity/base-entity.module', () => { }), }; - // Export the mock for tests to use - global.MockBaseEntityModule = MockBaseEntityModule; - return { BaseEntityModule: MockBaseEntityModule, }; }); -// Get the mock from global for test assertions -const MockBaseEntityModule = global.MockBaseEntityModule; - // Import all configs and entities import userConfig from '../../shared/entities/configs/user.config'; import attReportConfig from '../entity-modules/att-report.config'; diff --git a/server/src/entity-modules/__tests__/student-by-year.config.spec.ts b/server/src/entity-modules/__tests__/student-by-year.config.spec.ts index df2e382c..db86742a 100644 --- a/server/src/entity-modules/__tests__/student-by-year.config.spec.ts +++ b/server/src/entity-modules/__tests__/student-by-year.config.spec.ts @@ -1,6 +1,6 @@ import config, { Utils } from '../student-by-year.config'; import { StudentByYear } from 'src/db/view-entities/StudentByYear.entity'; -import { DataSource, Repository } from 'typeorm'; +import { DataSource } from 'typeorm'; import { Test, TestingModule } from '@nestjs/testing'; import { BaseEntityService } from '@shared/base-entity/base-entity.service'; import { ReportMonthSemester } from 'src/db/entities/ReportMonth.entity'; @@ -28,7 +28,6 @@ describe('StudentByYear Config', () => { let service: BaseEntityService; let module: TestingModule; let mockDataSource: Partial; - let mockRepository: Repository; let mockMailService: Partial; beforeEach(async () => { diff --git a/server/src/entity-modules/__tests__/student-klass.config.spec.ts b/server/src/entity-modules/__tests__/student-klass.config.spec.ts index abfc6053..28a09c14 100644 --- a/server/src/entity-modules/__tests__/student-klass.config.spec.ts +++ b/server/src/entity-modules/__tests__/student-klass.config.spec.ts @@ -1,7 +1,6 @@ import { CrudRequest } from '@dataui/crud'; import { DataSource, In, Repository } from 'typeorm'; import { StudentKlass } from 'src/db/entities/StudentKlass.entity'; -import { BulkToPdfReportGenerator } from '@shared/utils/report/bulk-to-pdf.generator'; import { MailerService } from '@nestjs-modules/mailer'; import { MailSendService } from '@shared/utils/mail/mail-send.service'; import { BaseEntityService } from '@shared/base-entity/base-entity.service'; diff --git a/server/src/entity-modules/__tests__/teacher-report-status.config.spec.ts b/server/src/entity-modules/__tests__/teacher-report-status.config.spec.ts index b40f15a2..cfadcf6b 100644 --- a/server/src/entity-modules/__tests__/teacher-report-status.config.spec.ts +++ b/server/src/entity-modules/__tests__/teacher-report-status.config.spec.ts @@ -1,9 +1,7 @@ -import { Test } from '@nestjs/testing'; import { jest, describe, expect, it, beforeEach } from '@jest/globals'; import { TeacherReportStatus } from 'src/db/view-entities/TeacherReportStatus.entity'; import { DataSource } from 'typeorm'; import { MailSendService } from '@shared/utils/mail/mail-send.service'; -import teacherReportFile from 'src/reports/teacherReportFile'; import * as reportGenerator from 'src/reports/reportGenerator'; import config from '../teacher-report-status.config'; import { CrudRequest } from '@dataui/crud'; diff --git a/server/src/entity-modules/student-by-year.config.ts b/server/src/entity-modules/student-by-year.config.ts index 5913cdda..d8b1a77a 100644 --- a/server/src/entity-modules/student-by-year.config.ts +++ b/server/src/entity-modules/student-by-year.config.ts @@ -162,7 +162,7 @@ class StudentByYearService extends BaseEntityS label: 'אחוז חיסורים כולל', }; - (data[0] as any).headers = Object.values(headers); + Object.assign(data[0], { headers: Object.values(headers) }); } private async populateStudentAttendanceByKlass( @@ -276,7 +276,7 @@ class StudentByYearService extends BaseEntityS { value: 'totalAbsenceRatio', label: 'אחוז חיסורים כולל', numFmt: '0.00%', thresholds: ABSENCE_THRESHOLDS }, ]; - (data[0] as any).headers = [...Object.values(headers), ...summaryHeaders]; + Object.assign(data[0], { headers: [...Object.values(headers), ...summaryHeaders] }); } private buildBaseWhere( diff --git a/server/src/entity-modules/student-percent-report.config.ts b/server/src/entity-modules/student-percent-report.config.ts index aacf7f3d..8fac588d 100644 --- a/server/src/entity-modules/student-percent-report.config.ts +++ b/server/src/entity-modules/student-percent-report.config.ts @@ -185,7 +185,7 @@ class StudentPercentReportService exten headers['estimation'] = { value: 'estimation', label: 'הערכה' }; headers['comments'] = { value: 'comments', label: 'הערה' }; headers['estimatedAbsPercents'] = { value: 'estimatedAbsPercents', label: 'אחוז חיסור משוער' }; - (data[0] as any).headers = Object.values(headers); + Object.assign(data[0], { headers: Object.values(headers) }); } } }