test-setup.md 1.77 KB

测试环境说明

单元测试

npm test

运行 packageDynamicForm/tests/**/*.test.mjs(Node 内置 node:test),当前约 399 条用例。目录位于动态表单分包内,上传时由 project.config.json packOptions.ignore 排除。

按模块索引

测试文件 覆盖
form-engine.test.mjs 显隐、校验、submit、select/radio、门店 schema
staffDailyReportAdapters.test.mjs 驻店 adapter、apiSwitch、brand 缓存
storeDailyReportAdapters.test.mjs 门店 adapter、洽谈 brand、detail.get
staffDailyFormLoader.test.mjs 驻店加载链
storeDailyFormLoader.test.mjs 门店加载链
fieldOptionsAdapters.test.mjs optionsKey、getEmployeeList
dailyReportWeeklyList.test.mjs 周历 templateType 1/2/3
configCenterTemplate.test.mjs 配置中心 indexed map
dynamicFormMenus.test.mjs 首页菜单 navigateToUrl
car-brand-*.test.mjs 品牌 API / 树 / picker
group-*.test.mjs subform 行、showRule
userMerchant.test.mjs shopMerchantId 解析

完整 ID 列表见 integration-test-plan.md。

手动集成测试

  1. 微信开发者工具打开本项目
  2. 登录精品场景 → 首页确认 3 个入口 → 逐一点击验证路由
  3. 切换权益场景 → 重复步骤 2
  4. 在 integration-test-plan.md 勾选结果

Fixtures

  • 代码 fixture:packageDynamicForm/fixtures/(schema-*-full、mock-meta、mock-field-options)
  • 文档 fixture:packageDynamicForm/docs/fixtures/
  • 单测加载:packageDynamicForm/tests/schemaFixture.mjs → loadSchemaFixture('staff'|'store'|'negotiation')

与 动态表单Schema设计.md 对齐。