netxops/test/group-skills.test.mjs
oliver 63f88bdf6c Merge nms+common into ops so login questions load execManagedNe.
One capability group now ships netx-ops (alarms + managed CLI + paths); keep tools-nms/common as aliases.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 02:11:02 +08:00

32 lines
1.2 KiB
JavaScript

/**
* Group skill loader: one capability group ↔ one skill dir.
*/
import assert from 'node:assert/strict'
import test from 'node:test'
import { readdirSync, readFileSync, existsSync } from 'node:fs'
import { join } from 'node:path'
import { opsSkillsRoot } from '../src/netx/group-skills.ts'
import { SKILL_DIR_BY_GROUP } from '../src/netx/capability-groups.ts'
test('opsSkillsRoot points at ops / topology playbook dirs', () => {
const root = opsSkillsRoot()
assert.ok(existsSync(root), root)
for (const dir of Object.values(SKILL_DIR_BY_GROUP)) {
assert.ok(existsSync(join(root, dir)), join(root, dir))
}
})
test('each group dir has a playbook with name + description', () => {
const root = opsSkillsRoot()
for (const group of Object.keys(SKILL_DIR_BY_GROUP)) {
const groupDir = join(root, SKILL_DIR_BY_GROUP[group])
const bundles = readdirSync(groupDir).filter((name) => existsSync(join(groupDir, name, 'SKILL.md')))
assert.ok(bundles.length >= 1, group)
const raw = readFileSync(join(groupDir, bundles[0], 'SKILL.md'), 'utf8')
assert.match(raw, /^---\r?\n/)
assert.match(raw, /\nname:\s+\S+/)
assert.match(raw, /\ndescription:\s/)
}
})