loqatevars
Version:
Locate JavaScript files with 'const' or 'process.env' usage in LLM-generated codebases
30 lines (24 loc) • 811 B
JavaScript
const { main } = require('../cli.js');
const utils = require('../lib/utils.js');
jest.mock('../lib/utils.js');
describe('CLI help command', () => {
let logSpy;
let exitSpy;
beforeEach(() => {
logSpy = jest.spyOn(console, 'log').mockImplementation();
exitSpy = jest.spyOn(process, 'exit').mockImplementation();
});
afterEach(() => {
logSpy.mockRestore();
exitSpy.mockRestore();
jest.clearAllMocks();
});
test('loqatevars help shows usage info', async () => {
process.argv = ['node', 'cli.js', 'help'];
await main();
expect(utils.findMatchingFiles).not.toHaveBeenCalled();
const output = logSpy.mock.calls.map(c => c.join(' ')).join('\n');
expect(output).toMatch(/Commands:/); // confirm help output
expect(exitSpy).not.toHaveBeenCalled();
});
});