mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-08-28 05:25:25 +00:00
* feat: configure eslint with unused import removal Add ESLint v9 (flat config) for code quality: - eslint-plugin-unused-imports for auto-removing dead imports - @typescript-eslint for TypeScript-aware linting - eslint-plugin-react-hooks for React hooks rules - eslint-config-prettier to avoid formatting conflicts - lint-staged runs eslint --fix before prettier on .ts/.tsx - CI lint job added to ci-quality.yml * refactor: remove unused imports via eslint --fix Auto-fixed by eslint-plugin-unused-imports. No logic changes. * chore: add eslint fix commit to .git-blame-ignore-revs
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest';
|
|
|
|
// Mock all the heavy imports before importing index
|
|
vi.mock('../../src/cli/analyze.js', () => ({
|
|
analyzeCommand: vi.fn(),
|
|
}));
|
|
vi.mock('../../src/cli/mcp.js', () => ({
|
|
mcpCommand: vi.fn(),
|
|
}));
|
|
vi.mock('../../src/cli/setup.js', () => ({
|
|
setupCommand: vi.fn(),
|
|
}));
|
|
|
|
describe('CLI commands', () => {
|
|
describe('version', () => {
|
|
it('package.json has a valid version string', async () => {
|
|
const pkg = await import('../../package.json', { with: { type: 'json' } });
|
|
expect(pkg.default.version).toMatch(/^\d+\.\d+\.\d+/);
|
|
});
|
|
});
|
|
|
|
describe('package.json scripts', () => {
|
|
it('has test scripts configured', async () => {
|
|
const pkg = await import('../../package.json', { with: { type: 'json' } });
|
|
expect(pkg.default.scripts.test).toBeDefined();
|
|
expect(pkg.default.scripts['test:integration']).toBeDefined();
|
|
expect(pkg.default.scripts['test:unit']).toBeDefined();
|
|
});
|
|
|
|
it('has build script', async () => {
|
|
const pkg = await import('../../package.json', { with: { type: 'json' } });
|
|
expect(pkg.default.scripts.build).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('package.json bin entry', () => {
|
|
it('exposes gitnexus binary', async () => {
|
|
const pkg = await import('../../package.json', { with: { type: 'json' } });
|
|
expect(pkg.default.bin).toBeDefined();
|
|
expect(pkg.default.bin.gitnexus || pkg.default.bin).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('analyzeCommand', () => {
|
|
it('is a function', async () => {
|
|
const { analyzeCommand } = await import('../../src/cli/analyze.js');
|
|
expect(typeof analyzeCommand).toBe('function');
|
|
});
|
|
});
|
|
|
|
describe('mcpCommand', () => {
|
|
it('is a function', async () => {
|
|
const { mcpCommand } = await import('../../src/cli/mcp.js');
|
|
expect(typeof mcpCommand).toBe('function');
|
|
});
|
|
});
|
|
|
|
describe('setupCommand', () => {
|
|
it('is a function', async () => {
|
|
const { setupCommand } = await import('../../src/cli/setup.js');
|
|
expect(typeof setupCommand).toBe('function');
|
|
});
|
|
});
|
|
});
|