mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Phase 3 — Code Quality: - Deduplicate nowUnix() in lock-ops.mjs (import from utils.mjs) - Promote ESLint no-unused-vars to error, fix all 46 violations - Remove dead code: unused imports, variables, and catch bindings - Add /* global marked */ for CDN-loaded library in dashboard Phase 4 — CI/CD: - Add Node.js version matrix (22, 23) to CI workflow - Add npm audit security scan step to CI - Add innerHTML usage check to CI pipeline - Enable Dependabot for npm and GitHub Actions dependencies - Create PR template Phase 5 — Developer Experience: - Create .env.example documenting all environment variables - Expand CONTRIBUTING.md with commit conventions, agent/prompt creation guide, architecture overview, and test integrity - Add system architecture diagram with Mermaid (docs/architecture/) https://claude.ai/code/session_01GfwUNbgeMgXreFDbsNQMsS
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert';
|
|
import { spawnSync } from 'node:child_process';
|
|
import fs from 'node:fs';
|
|
|
|
describe('CLI Smoke Test', () => {
|
|
it('should print usage when no args provided', () => {
|
|
const result = spawnSync('node', ['bin/torch-lock.mjs']);
|
|
assert.strictEqual(result.status, 1);
|
|
assert.match(result.stderr.toString(), /Usage:/);
|
|
});
|
|
|
|
it('should fail when checking without cadence', () => {
|
|
const result = spawnSync('node', ['bin/torch-lock.mjs', 'check']);
|
|
assert.strictEqual(result.status, 1);
|
|
assert.match(result.stderr.toString(), /--cadence <daily|weekly> is required/);
|
|
});
|
|
|
|
it('should include paused agents in check output', () => {
|
|
const configPath = 'test-torch-config.json';
|
|
fs.writeFileSync(configPath, JSON.stringify({
|
|
scheduler: { paused: { daily: ['paused-agent'] } }
|
|
}));
|
|
|
|
try {
|
|
const result = spawnSync('node', ['bin/torch-lock.mjs', 'check', '--cadence', 'daily'], {
|
|
env: { ...process.env, TORCH_CONFIG_PATH: configPath }
|
|
});
|
|
const output = JSON.parse(result.stdout.toString());
|
|
assert.deepStrictEqual(output.paused, ['paused-agent']);
|
|
assert.ok(output.excluded.includes('paused-agent'));
|
|
} finally {
|
|
if (fs.existsSync(configPath)) {
|
|
fs.unlinkSync(configPath);
|
|
}
|
|
}
|
|
});
|
|
});
|