test: cover end-to-end attendance workflow #41

Merged
wangziqi merged 3 commits from worktree-working-session into main 2026-07-23 04:10:31 +00:00
Showing only changes of commit 0bdc8a067b - Show all commits

View File

@@ -103,11 +103,6 @@ describe('attendance workflow integration', () => {
});
it('imports students, builds a teacher class schedule, refreshes punches, and scopes reads', async () => {
let classId: number;
let scheduleId: number;
let studentA: Student;
let studentB: Student;
const roleRepo = app.get<Repository<Role>>(getRepositoryToken(Role));
const userRepo = app.get<Repository<User>>(getRepositoryToken(User));
const studentRepo = app.get<Repository<Student>>(getRepositoryToken(Student));
@@ -168,7 +163,7 @@ describe('attendance workflow integration', () => {
.expect(201);
expect(importResult.body).toMatchObject({ imported: 2, skipped: 0 });
[studentA, studentB] = await Promise.all([
const [studentA, studentB] = await Promise.all([
studentRepo.findOneByOrFail({ phone: '13800000001' }),
studentRepo.findOneByOrFail({ phone: '13800000002' }),
]);
@@ -189,7 +184,7 @@ describe('attendance workflow integration', () => {
endDate: LESSON_DATE,
})
.expect(201);
classId = classResult.body.id;
const classId = classResult.body.id;
await request(app.getHttpServer())
.post(`/api/classes/${classId}/students`)
@@ -227,7 +222,7 @@ describe('attendance workflow integration', () => {
scheduleType: 'INTERNAL',
})
.expect(201);
scheduleId = scheduleResult.body.id;
const scheduleId = scheduleResult.body.id;
const initialPull = await request(app.getHttpServer())
.post(`/api/attendance-lessons/schedules/${scheduleId}/pull`)