fix: restore CLI validation and test baseline (#1857)

Fixed lazy CLI helper imports for tunnel flows
Restored update command version detection
Made web test and dead-code commands run reliably
This commit is contained in:
Bohdan Triapitsyn
2026-06-27 09:45:34 +03:00
parent 38c9ff77c9
commit 5cc37d0c33
12 changed files with 70 additions and 11 deletions
@@ -6,7 +6,7 @@ vi.mock('node:child_process', () => ({
spawnSync: vi.fn(() => ({ status: 0, stdout: '/usr/local/bin', stderr: '' })),
}));
const { checkForUpdates } = await import('./package-manager.js');
const { checkForUpdates, getCurrentVersion } = await import('./package-manager.js');
/** Helper: create a fetch mock that routes by URL pattern */
function createFetchMock() {
@@ -244,3 +244,10 @@ describe('checkForUpdates', () => {
expect(result.available).toBe(false);
});
});
describe('getCurrentVersion', () => {
it('is exported for the CLI update command', () => {
expect(typeof getCurrentVersion).toBe('function');
expect(getCurrentVersion()).toMatch(/^\d+\.\d+\.\d+|unknown$/);
});
});