Files
clawpanel/tests/site-update-source-policy.test.js
2026-06-06 18:32:37 +08:00

25 lines
955 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
const devApi = readFileSync(new URL('../scripts/dev-api.js', import.meta.url), 'utf8')
const rustConfig = readFileSync(new URL('../src-tauri/src/commands/config.rs', import.meta.url), 'utf8')
test('ClawPanel 版本发现只使用官网 API不再回退 GitHub/Gitee release API', () => {
for (const source of [devApi, rustConfig]) {
assert.doesNotMatch(
source,
/api\.github\.com\/repos\/qingchencloud\/clawpanel\/releases\/latest/,
'版本发现不应再请求 GitHub releases latest API',
)
assert.doesNotMatch(
source,
/gitee\.com\/api\/v5\/repos\/QtCodeCreators\/clawpanel\/releases\/latest/,
'版本发现不应再请求 Gitee releases latest API',
)
}
assert.match(devApi, /return await getSitePanelUpdate\(\)/)
assert.match(rustConfig, /site_latest_for_panel_update\(\)/)
})