Files
flow-center-front/tests/app-url.test.ts
T
chenxing c93313cdb7
build / build (push) Successful in 1m28s
feat(flow): 流程图入口/失败提示/指派预览/线级停发闭环/配置分层/选人宿主
- 修复办理页「查看流程图」双 hash URL:改 router.resolve + toAppHashUrl 单 hash
- 修复管理端办件抽屉「查看大图」域名尾点(origin + BASE_URL("./") 拼接)
- 新增 flowError 口径层与办理页内联失败条,审批失败提示可读、不泄漏堆栈
- 审批节点抽屉新增「预览候选人」真入口 + AssigneePreviewModal(只读,不写回定义)
- 线级停发/恢复失败改为单条错误面,避免同错双 toast
- 审批抽屉核心区/高级设置分层;插入菜单常用/高级分组
- 新增 FlowAssignEmbed 选人 iframe 父侧宿主(origin/source/信封/context 四校验)
- 修复 /diagram、/assign-preview 面包屑误显示「流程编辑器」
2026-10-28 03:18:54 +08:00

49 lines
2.3 KiB
TypeScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { toAppHashUrl } from "../src/utils/appUrl";
/** 整页跳转地址单测:只锁「最终只有一个 hash」这条线上缺陷口径,不替代浏览器实测 */
test("办理页入口:resolve 出的 #/diagram 不再追加到当前 hash 之后", () => {
const out = toAppHashUrl(
"#/diagram?instanceId=107&mode=user",
"https://base.yhxt.com.cn/flow-center/front/index.html#/task/339",
);
assert.equal(out, "https://base.yhxt.com.cn/flow-center/front/index.html#/diagram?instanceId=107&mode=user");
assert.equal(out.split("#").length - 1, 1);
});
test("参数原样保留:instanceId 与 mode 不因去 hash 而丢失", () => {
const out = toAppHashUrl("#/diagram?instanceId=107&mode=dept", "https://h/flow-center/front/index.html#/task/339");
assert.match(out, /instanceId=107/);
assert.match(out, /mode=dept/);
});
test("无 hash 的入口地址:直接接上目标 hash", () => {
assert.equal(
toAppHashUrl("#/diagram?instanceId=1", "https://h/flow-center/front/index.html"),
"https://h/flow-center/front/index.html#/diagram?instanceId=1",
);
});
test("真实 query 保留在 hash 之前(部署带 ?v= 缓存位时不被吞)", () => {
assert.equal(
toAppHashUrl("#/diagram?instanceId=1", "https://h/index.html?v=9#/task/339"),
"https://h/index.html?v=9#/diagram?instanceId=1",
);
});
test("不带前导 # 的 resolve 结果同样归一,且不出现双 hash", () => {
const out = toAppHashUrl("/diagram?instanceId=1", "https://h/index.html#/task/339");
assert.equal(out, "https://h/index.html#/diagram?instanceId=1");
});
test("查看大图:不再用 origin+BASE_URL 拼出 host 尾点地址", () => {
// 旧写法 origin + "./" + "#/diagram?…" 会得到 https://base.yhxt.com.cn./#/diagram?…
const legacy = `${"https://base.yhxt.com.cn"}${"./"}#/diagram?instanceId=1`;
assert.match(legacy, /com\.cn\.\//);
const fixed = toAppHashUrl("#/diagram?instanceId=1", "https://base.yhxt.com.cn/flow-center/front/index.html#/admin/instances");
assert.ok(!/\.cn\.\//.test(fixed), fixed);
assert.equal(fixed, "https://base.yhxt.com.cn/flow-center/front/index.html#/diagram?instanceId=1");
});