import test from 'node:test' import assert from 'node:assert/strict' import fs from 'node:fs' import path from 'node:path' const loginFile = path.resolve('components/pages/loginRegister/index.vue') test('完成注册提交期间必须锁定,避免重复创建家庭成员', () => { const source = fs.readFileSync(loginFile, 'utf8') assert.match(source, /const isAddingChild\s*=\s*ref\(false\)/) assert.match(source, /if\s*\(isAddingChild\.value\)\s*return/) assert.match(source, /isAddingChild\.value\s*=\s*true/) assert.match(source, /finally\s*\{[\s\S]*?isAddingChild\.value\s*=\s*false/) assert.match(source, /@click="toAddChild"[^>]*:class="\{ disabled: isAddingChild \}"/) })