Files
baiyue-firstleg/scripts/agents-index-registry-contract.test.mjs
T

25 lines
1.2 KiB
JavaScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./agents-index-contract.ps1', import.meta.url), 'utf8')
test('cleared test registry is mandatory and cannot inherit historical task authorization', () => {
for (const token of [
"Assert-Contains $testTaskRegistry '当前无登记任务'",
"Assert-Contains $testTaskRegistry '清空全部任务登记与调度规则'",
"Assert-Contains $testTaskRegistry '不根据旧登记、历史消息或历史台账自动派工、恢复任务或回传进度'",
"Assert-Contains $testTaskRegistry '不作为当前调度或授权依据'",
"Assert-NotContains $testTaskRegistry '已重新启用测试环境总控调度'",
]) assert.ok(source.includes(token), token)
assert.match(source, /if \(\$testTaskRegistry -match '\(\?m\)\^\\\|\\s\*`\[0-9a-f-\]\{36\}`\\s\*\\\|'\)/)
})
test('cleared registry rejects every retired controller and project identity', () => {
for (const retired of [
'01a0194a-259c-7171-8967-074731a27618',
'01a06c0b-0515-7c60-b329-77342b54e666',
'6f874ec3-d3b2-49bd-8625-327f4d685f98',
]) assert.match(source, new RegExp(`Assert-NotContains \\$testTaskRegistry '${retired}'`))
})