cmvr-wms/ruoyi-ui-vue3/tests/unit/local-development-launcher.test.mjs
lixiaolong cd86623061 feat(app): 添加服务器连接管理和到货操作功能
- 集成 ServerConnection 组件用于开发环境服务器切换
- 实现多服务器令牌隔离存储机制
- 添加 ArrivalOperation 屏幕处理到货和验收流程
- 支持待登记到货和待验收状态切换
- 优化库存操作界面的字段显示逻辑
- 增强 Excel 文件分片上传支持产品文件识别
- 添加 AI 助手会话滚动跟踪功能
- 实现开发服务器地址持久化存储
- 优化登录界面集成服务器连接组件
- 添加领用出库功能支持项目物资使用
- 改进盘点确认生效的操作流程
- 增强采购到货登记和验收的权限控制
- 优化移动端文件上传的断点续传机制
- 添加服务器切换时的数据清理保护机制
- 实现紧凑金额显示模式减少界面冗余
- 增强库存操作的数量验证和错误提示
- 优化 AI 助手的会话状态同步机制
2026-10-20 10:04:17 +08:00

33 lines
1.9 KiB
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import {readFileSync} from 'node:fs'
const manager=readFileSync(new URL('../../../scripts/projectdev/Backend-Local.ps1',import.meta.url),'utf8')
const starter=readFileSync(new URL('../../../scripts/projectdev/Start-Local.ps1',import.meta.url),'utf8')
test('local launchers never request elevation or change Windows execution policy',()=>{
for(const source of [manager,starter]){
assert.doesNotMatch(source,/-Verb\s+RunAs|Set-ExecutionPolicy|Register-ScheduledTask|schtasks/i)
assert.match(source,/IsInRole\(\[Security\.Principal\.WindowsBuiltInRole\]::Administrator\)/)
assert.match(source,/throw '.*normal/i)
}
})
test('the backend manager checks process identity and port before stopping only its recorded process',()=>{
for(const guard of ['processStartTicks','ExecutablePath','CommandLine','--spring.profiles.active=druid','Port 8080 belongs to another process','backend.lock'])assert.ok(manager.includes(guard),guard)
assert.match(manager,/Stop-Process -Id \$taskOwned\.ProcessId/)
assert.doesNotMatch(manager,/taskkill|Stop-Process\s+-Name|Remove-Item|\bprod\b/i)
})
test('ordinary local startup preserves legacy upload settings and reuses immutable runtime jars',()=>{
assert.match(manager,/Get-FileHash.*SHA256/)
assert.match(manager,/buildSha256=\$taskBuildHash/)
assert.doesNotMatch(manager,/\$env:RUOYI_PROFILE\s*=/)
assert.match(manager,/administrator=\$false/)
assert.match(starter,/Backend-Local\.ps1/)
})
test('clickable launchers use PowerShell 7 without policy bypass or administrator verbs',()=>{
for(const file of ['Start-Local.cmd','Restart-Backend.cmd']){
const source=readFileSync(new URL('../../../scripts/projectdev/'+file,import.meta.url),'utf8')
assert.match(source,/powershell\\pwsh\.exe/)
assert.match(source,/-NoProfile -File/)
assert.doesNotMatch(source,/Bypass|RunAs|ExecutionPolicy/i)
}
})