mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-05 15:49:43 +08:00
20 lines
771 B
JavaScript
20 lines
771 B
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
const channelsPageSource = readFileSync(new URL('../src/pages/channels.js', import.meta.url), 'utf8')
|
|
|
|
function getRegistryBlock(platformId) {
|
|
const start = channelsPageSource.indexOf(` ${platformId}: {`)
|
|
assert.notEqual(start, -1, `未找到 ${platformId} 渠道注册表`)
|
|
const next = channelsPageSource.indexOf('\n slack: {', start + 1)
|
|
return channelsPageSource.slice(start, next === -1 ? undefined : next)
|
|
}
|
|
|
|
test('Discord 渠道 UI 会暴露服务器频道 allowlist 配置字段', () => {
|
|
const discordBlock = getRegistryBlock('discord')
|
|
|
|
assert.match(discordBlock, /key:\s*'guildId'/)
|
|
assert.match(discordBlock, /key:\s*'channelId'/)
|
|
})
|