Files
aicommits/tests/specs/cli/error-cases.ts
Rocktim ebe83a493e feat: --all flag (#182)
Co-authored-by: Hiroki Osame <hiroki.osame@gmail.com>
2023-04-01 06:19:34 -04:00

25 lines
933 B
TypeScript

import { testSuite, expect } from 'manten';
import { createFixture, createGit } from '../../utils.js';
export default testSuite(({ describe }) => {
describe('Error cases', async ({ test }) => {
test('Fails on non-Git project', async () => {
const { fixture, aicommits } = await createFixture();
const { stdout, exitCode } = await aicommits([], { reject: false });
expect(exitCode).toBe(1);
expect(stdout).toMatch('The current directory must be a Git repository!');
await fixture.rm();
});
test('Fails on no staged files', async () => {
const { fixture, aicommits } = await createFixture();
await createGit(fixture.path);
const { stdout, exitCode } = await aicommits([], { reject: false });
expect(exitCode).toBe(1);
expect(stdout).toMatch('No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.');
await fixture.rm();
});
});
});