|
|
@@ -1568,7 +1568,7 @@ describe('home learning modules', () => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- it('ends without requiring feedback and displays the server-confirmed lesson pay', async () => {
|
|
|
+ it('ends without requiring feedback and keeps lesson pay out of the completion notice', async () => {
|
|
|
user.set({userId:300,userName:'coach',honeyName:'张老师',groupId:3});session.groupId.set(3);
|
|
|
const api=TestBed.inject(ApiService) as unknown as LearningModulesApiService;api.appointmentStatus=10;
|
|
|
spyOn(TestBed.inject(PlatformService),'confirm').and.resolveTo(true);
|
|
|
@@ -1576,7 +1576,7 @@ describe('home learning modules', () => {
|
|
|
const component=harness.fixture.debugElement.query(By.directive(AppointmentPageComponent)).componentInstance as AppointmentPageComponent;
|
|
|
await component.endLesson();expect(api.completionRequests.length).toBe(1);expect(api.completionRequests[0]['feedback']).toBeUndefined();
|
|
|
api.appointmentStatus=30;api.completionResponse.next({retcode:0,result:{status:30,teacherPay:45,payStatus:'earned',feedbackStatus:'pending'}});api.completionResponse.complete();
|
|
|
- harness.fixture.detectChanges();expect(harness.routeNativeElement?.textContent).toContain('本节带课工资 ¥45.00');expect(harness.routeNativeElement?.textContent).toContain('反馈待补');
|
|
|
+ harness.fixture.detectChanges();expect(harness.routeNativeElement?.textContent).toContain('已结课');expect(harness.routeNativeElement?.textContent).not.toMatch(/工资|¥45/);expect(harness.routeNativeElement?.textContent).toContain('反馈待补');
|
|
|
});
|
|
|
|
|
|
it('retains the optional feedback-and-complete dialog and submits once after validation', async () => {
|
|
|
@@ -1885,23 +1885,31 @@ describe('home learning modules', () => {
|
|
|
expect(harness.routeNativeElement?.querySelectorAll('.learning-record-card .learning-item').length).toBe(5);
|
|
|
expect((harness.routeNativeElement?.querySelectorAll('.record-pagination button')[1] as HTMLButtonElement).disabled).toBeTrue();
|
|
|
});
|
|
|
- it('shows the server half-yuan reward and distinguishes student self-study from overdue work', async()=>{
|
|
|
+ it('keeps review completion free of pay details for every reward outcome', async()=>{
|
|
|
user.set({userId:300,groupId:3,honeyName:'老师'});session.groupId.set(3);session.student.set({userId:100,groupId:1});
|
|
|
const harness=await RouterTestingHarness.create('/pages/stu/record?id=900&gid=103');await harness.fixture.whenStable();
|
|
|
const component=harness.fixture.debugElement.query(By.directive(LearningPageComponent)).componentInstance as LearningPageComponent;
|
|
|
- component.reviewCompletion.set({amount:0.5,rewardStatus:'earned'});harness.fixture.detectChanges();
|
|
|
- expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('本次收入 ¥0.50');
|
|
|
- component.reviewCompletion.set({amount:0,rewardStatus:'ineligible',ineligibleReason:'self_study',unchanged:true});harness.fixture.detectChanges();
|
|
|
- expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('学生自习,不计薪');
|
|
|
- expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toContain('逾期补做');
|
|
|
- component.reviewCompletion.set({amount:0,rewardStatus:'ineligible',ineligibleReason:'duplicate_review',unchanged:true});harness.fixture.detectChanges();
|
|
|
- expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('重复复习,不重复计薪');
|
|
|
+ for (const result of [
|
|
|
+ {amount:0.5,rewardStatus:'earned'},
|
|
|
+ {amount:1,rewardStatus:'earned',unchanged:true},
|
|
|
+ {amount:0,rewardStatus:'ineligible',ineligibleReason:'self_study',unchanged:true},
|
|
|
+ {amount:0,rewardStatus:'ineligible',ineligibleReason:'duplicate_review',unchanged:true},
|
|
|
+ {amount:0,rewardStatus:'ineligible'},
|
|
|
+ {amount:0,rewardStatus:'pending'},
|
|
|
+ ]) {
|
|
|
+ component.reviewCompletion.set(result);harness.fixture.detectChanges();
|
|
|
+ const completion=harness.routeNativeElement?.querySelector('.review-complete');
|
|
|
+ expect(completion?.textContent).toContain('复习已完成');
|
|
|
+ expect(completion?.textContent).not.toMatch(/收入|工资|计薪|记账|¥/);
|
|
|
+ expect(completion?.textContent).toContain('继续今日任务');
|
|
|
+ expect(completion?.textContent).toContain('返回原任务列表');
|
|
|
+ }
|
|
|
user.set({userId:100,groupId:1,honeyName:'学生'});session.groupId.set(1);harness.fixture.detectChanges();
|
|
|
expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('复习已完成');
|
|
|
- expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toContain('收入');
|
|
|
+ expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toMatch(/收入|工资|计薪|记账|¥/);
|
|
|
});
|
|
|
|
|
|
- it('waits for server completion, blocks duplicate clicks and shows zero for overdue work', async()=>{
|
|
|
+ it('waits for server completion and blocks duplicate clicks for overdue work', async()=>{
|
|
|
user.set({userId:300,groupId:3,honeyName:'老师'});session.groupId.set(3);session.student.set({userId:100,groupId:1});
|
|
|
const api=TestBed.inject(ApiService),post=api.post.bind(api),reply=new Subject<ApiEnvelope<any>>();
|
|
|
const submit=spyOn(api,'post').and.callFake((action,params)=>action==='app_review_complete'?reply:post(action,params));
|
|
|
@@ -1910,7 +1918,7 @@ describe('home learning modules', () => {
|
|
|
component.endRecord();component.endRecord();harness.fixture.detectChanges();expect(component.reviewCompletion()).toBeNull();expect(component.canDeactivate()).toBeFalse();
|
|
|
expect(submit.calls.allArgs().filter(a=>a[0]==='app_review_complete').length).toBe(1);
|
|
|
reply.next({retcode:1,result:{amount:0,rewardStatus:'ineligible',completed:true}});reply.complete();harness.fixture.detectChanges();
|
|
|
- expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('本次收入 ¥0.00');expect(component.canDeactivate()).toBeTrue();
|
|
|
+ expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).toContain('复习已完成');expect(harness.routeNativeElement?.querySelector('.review-complete')?.textContent).not.toMatch(/收入|工资|计薪|¥/);expect(component.canDeactivate()).toBeTrue();
|
|
|
});
|
|
|
|
|
|
});
|