初始提交:ai-review 项目当前版本(含赛道一/二提交规范修订与时间节点文档)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import http from 'http';
|
||||
|
||||
function req(method, path, body, token) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const opts = { hostname: 'localhost', port: 3002, path, method, headers: { 'Content-Type': 'application/json' } };
|
||||
if (token) opts.headers['Authorization'] = 'Bearer ' + token;
|
||||
const r = http.request(opts, res => { let d = ''; res.on('data', c => d += c); res.on('end', () => resolve(JSON.parse(d))); });
|
||||
r.on('error', reject);
|
||||
if (body) r.end(JSON.stringify(body)); else r.end();
|
||||
});
|
||||
}
|
||||
|
||||
const login = await req('POST', '/api/auth/login', { password: 'admin123' });
|
||||
console.log('Login:', login.token ? 'OK' : 'FAIL');
|
||||
|
||||
const proj = await req('POST', '/api/projects', { name: 'L2 Demo' }, login.token);
|
||||
console.log('Project:', proj.name);
|
||||
|
||||
const std = await req('POST', `/api/projects/${proj.id}/standards`, {
|
||||
name: 'L2标准',
|
||||
content: '## 功能完整性(25分)\n评审要点:闭环完整\n## 设计文档(15分)\n评审要点:架构合理\n## 测试用例(10分)\n评审要点:覆盖核心逻辑'
|
||||
}, login.token);
|
||||
console.log('Standard:', std.name, 'Dims:', std.dimensions?.length, JSON.stringify(std.dimensions?.map(d => ({ name: d.name, maxScore: d.maxScore }))));
|
||||
|
||||
console.log('All tests passed!');
|
||||
Reference in New Issue
Block a user