|
|
@@ -416,6 +416,22 @@ test('教师可以开始免教材语法写作,单词课仍要求有效开课
|
|
|
state.kcid='0';state.courseCategoryKey='word';assert.ok(!(await context.lessonOrderCapabilities(order,teacher)).allowedActions.includes('start'));
|
|
|
state.courseCategoryKey='high_writing';state.creditHoldStatus='insufficient';assert.ok(!(await context.lessonOrderCapabilities(order,teacher)).allowedActions.includes('start'));
|
|
|
});
|
|
|
+test('已在旧系统结束的写作课提示回旧系统确认,不再展示新系统结课',async()=>{
|
|
|
+ const {default:vm}=await import('node:vm');
|
|
|
+ const state={kcid:'398',sourceKey:'legacy:model:54:general:123',kssj:'2026-11-08 10:43',jssj:'2026-11-08 11:40',creditCostsSnapshot:null};
|
|
|
+ const lesson={pf:null};
|
|
|
+ const context={DEFAULT_COMPANY_ID:'co',number:Number,ownLegacyId:()=>30,fail:(_c,m)=>{throw Error(m);},
|
|
|
+ Psql:{oneOrNone:async(sql)=>sql.includes('FROM "CourseAppointment"')?state:sql.includes('FROM "LessonRecord"')?lesson:null}};
|
|
|
+ vm.createContext(context);
|
|
|
+ vm.runInContext(readFileSync(new URL('../cloud/lesson-workflow.js',import.meta.url),'utf8'),context);
|
|
|
+ const teacher={get:k=>k==='company'?{id:'co'}:null},order={GeneralID:123,pl:30,szyh:20,dszt:11};
|
|
|
+ const legacy=await context.lessonOrderCapabilities(order,teacher);
|
|
|
+ assert.deepEqual(Array.from(legacy.allowedActions),[]);
|
|
|
+ assert.match(legacy.blockedReason,/旧系统.*确认/);
|
|
|
+ state.creditCostsSnapshot=[{account:'SilverCoin',amount:1}];
|
|
|
+ assert.ok((await context.lessonOrderCapabilities(order,teacher)).allowedActions.includes('complete'));
|
|
|
+});
|
|
|
+
|
|
|
test('确认学段的旧阅读写作课保留原课程编号,开始结课后生成十轮复习',async()=>{
|
|
|
await db.exec('BEGIN');try{
|
|
|
await db.exec('ALTER TABLE "CourseAppointment" ADD COLUMN IF NOT EXISTS "categoryEvidence" text');
|