mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-09-24 15:49:09 +00:00
0ccea42785
- 在脚本配置中添加 targetGroups 字段用于指定动态组路径 - 更新工具规范定义以支持动态组路径参数 - 实现组范围的连接脚本动态继承功能 - 更新 CLI 适配器以支持 --target-groups 参数 - 添加测试用例验证动态组路径映射和解析 - 更新国际化资源文件添加相关提示文本 - 重构脚本目标匹配逻辑分离显式主机和组路径匹配 - 实现组路径变更时的重映射和删除处理逻辑 - 更新 UI 组件支持组路径选择和显示功能 - 修改文档描述更新动态组路径使用说明
26 lines
853 B
TypeScript
26 lines
853 B
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
remapSnippetTargetGroupPaths,
|
|
removeSnippetTargetGroupPaths,
|
|
} from './hostGroupPathMutations.ts';
|
|
import type { Snippet } from './models';
|
|
|
|
const snippets: Snippet[] = [{
|
|
id: 'script-a',
|
|
label: 'A',
|
|
command: 'echo a',
|
|
kind: 'script',
|
|
targetGroups: ['Production', 'Production/Web', 'Staging'],
|
|
}];
|
|
|
|
test('remapSnippetTargetGroupPaths follows group rename and descendants', () => {
|
|
const next = remapSnippetTargetGroupPaths(snippets, 'Production', 'Platform');
|
|
assert.deepEqual(next[0].targetGroups, ['Platform', 'Platform/Web', 'Staging']);
|
|
});
|
|
|
|
test('removeSnippetTargetGroupPaths removes a deleted group subtree', () => {
|
|
const next = removeSnippetTargetGroupPaths(snippets, ['Production']);
|
|
assert.deepEqual(next[0].targetGroups, ['Staging']);
|
|
});
|