mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
feat: 添加更好的 SQLite3 模块加载和错误处理,更新相关组件以支持项目路径
This commit is contained in:
37
ccw/tests/cli-manager-language-csrf.test.js
Normal file
37
ccw/tests/cli-manager-language-csrf.test.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Regression test: language settings toggles must use csrfFetch()
|
||||
* (otherwise /api/language/* POSTs will fail with 403 CSRF validation failed).
|
||||
*/
|
||||
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
describe('cli-manager language settings (CSRF)', () => {
|
||||
const source = readFileSync(
|
||||
new URL('../src/templates/dashboard-js/views/cli-manager.js', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
|
||||
it('uses csrfFetch() for /api/language/* POST requests', () => {
|
||||
assert.match(source, /await csrfFetch\('\/api\/language\/chinese-response',\s*\{/);
|
||||
assert.match(source, /await csrfFetch\('\/api\/language\/windows-platform',\s*\{/);
|
||||
assert.match(source, /await csrfFetch\('\/api\/language\/codex-cli-enhancement',\s*\{/);
|
||||
});
|
||||
|
||||
it('does not use bare fetch() for /api/language/* POST requests', () => {
|
||||
assert.doesNotMatch(
|
||||
source,
|
||||
/await fetch\('\/api\/language\/chinese-response',\s*\{[\s\S]*?method:\s*'POST'/
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
source,
|
||||
/await fetch\('\/api\/language\/windows-platform',\s*\{[\s\S]*?method:\s*'POST'/
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
source,
|
||||
/await fetch\('\/api\/language\/codex-cli-enhancement',\s*\{[\s\S]*?method:\s*'POST'/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user