|
|
@@ -6,6 +6,18 @@ describe('跨日期预约批量管理',()=>{
|
|
|
let ops:jasmine.SpyObj<OperationsService>;
|
|
|
const rows=Array.from({length:201},(_,i)=>({targetId:'a'+i,generalId:i+1,studentName:'学员'+i,coachName:'杨珍',courseName:'课程',startsAt:'2026-11-05T10:00:00+08:00',updatedAt:'2026-11-01T00:00:00.000Z',statusCode:i===199?10:0,cancelled:i===200,readOnly:false}));
|
|
|
beforeEach(()=>{ops=jasmine.createSpyObj<OperationsService>('OperationsService',['list','mutate','batchMutations']);ops.batchMutations.and.callFake(async work=>work());ops.list.and.callFake(async(_kind,page,size,search)=>({page,pageSize:size,total:rows.length,items:rows.slice((page-1)*size,page*size),refreshedAt:''}));TestBed.configureTestingModule({imports:[ScheduleBulkManagerComponent],providers:[{provide:OperationsService,useValue:ops}]});});
|
|
|
+ it('课程栏显示预约实际时长,历史缺失时明确待核对且不修改预约',async()=>{
|
|
|
+ ops.list.and.resolveTo({page:1,pageSize:25,total:3,items:[
|
|
|
+ {...rows[0],courseName:'阅读写作',classType:4,durationMinutes:60},
|
|
|
+ {...rows[1],courseName:'单词课',classType:2,durationMinutes:30},
|
|
|
+ {...rows[2],courseName:'历史课程'}
|
|
|
+ ],refreshedAt:''});
|
|
|
+ const fixture=TestBed.createComponent(ScheduleBulkManagerComponent);
|
|
|
+ fixture.detectChanges();await fixture.whenStable();fixture.detectChanges();
|
|
|
+ const courses=Array.from(fixture.nativeElement.querySelectorAll('tbody tr')).map((row:any)=>row.querySelectorAll('td')[4].textContent.replace(/\s+/g,' ').trim());
|
|
|
+ expect(courses).toEqual(['阅读写作 · 60分钟','单词课 · 30分钟','历史课程 · 时长待核对']);
|
|
|
+ expect(ops.mutate).not.toHaveBeenCalled();
|
|
|
+ });
|
|
|
it('按姓名跨日期查询,全选所有匹配页,排除已取消和训练中课程,并可取消单项',async()=>{
|
|
|
const c=TestBed.createComponent(ScheduleBulkManagerComponent).componentInstance;c.searchInput='杨珍';await c.searchAppointments();
|
|
|
expect(ops.list).toHaveBeenCalledWith('appointments',1,25,'杨珍',{dateFrom:'',dateTo:''});await c.selectAllMatching();expect(c.selected().size).toBe(199);expect(c.selected().has('a199')).toBeFalse();expect(c.selected().has('a200')).toBeFalse();
|