Files
admin 0593ff7e62
nginx serve /uploads direct (audio speed) / patch-nginx (push) Failing after 1m34s
数字我 Digital Me:全量入库(大文件走 Git LFS)
2026-10-10 16:24:43 +08:00

23 lines
1.1 KiB
JavaScript

// 水墨意象图 (#B1·通义万相) 的【优雅降级 + 红线】单测 —— 不联网、不需 DB,只证「默认关就一定 off」。
// 这就是「没开通不花钱、只显占位」那句承诺的机器证明。
// 跑:node --test test/inkart.test.js
import test from 'node:test';
import assert from 'node:assert/strict';
import { getInkScene, inkArtEnabled } from '../src/services/inkArt.js';
test('★ 默认关:未置 INK_ART_ENABLED ⇒ inkArtEnabled()=false', () => {
assert.equal(inkArtEnabled(), false);
});
test('★★ 优雅降级:功能关时任何朝都返回 {status:"off"}(不联网 / 不触库 / 零成本)', async () => {
for (const code of ['qin', 'tang', 'ming', 'liao', 'nanqi']) {
assert.deepEqual(await getInkScene(code), { status: 'off' }, `${code} 关闭时必须 off`);
}
});
test('★ 未知 code 静默 off(不生成、不报错,杜绝任意 prompt 注入)', async () => {
for (const bad of ['', 'bogus', 'DROP TABLE', '../x', 'qin ']) {
assert.deepEqual(await getInkScene(bad), { status: 'off' }, `坏 code「${bad}」必须 off`);
}
});