Skip to content

Commit

Permalink
test(github-models-cli): Add test for ProcessFailedException
Browse files Browse the repository at this point in the history
- Introduce a new test to verify that `ProcessFailedException` is thrown
- Set configuration for `github_models_cli.binary` before running the test
- Ensure correct handling of error generation with the `GeneratorManager`
- This test validates error handling for the GitHub models CLI generator
  • Loading branch information
[email protected] committed Nov 2, 2024
1 parent cf1bc1d commit 0ece92c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Unit/Generators/GithubModelsCliGeneratorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/** @noinspection AnonymousFunctionStaticInspection */
/** @noinspection JsonEncodingApiUsageInspection */
/** @noinspection NullPointerExceptionInspection */
/** @noinspection PhpUnhandledExceptionInspection */
/** @noinspection PhpUnused */
/** @noinspection PhpUnusedAliasInspection */
/** @noinspection StaticClosureCanBeUsedInspection */

declare(strict_types=1);

/**
* This file is part of the guanguans/ai-commit.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

use App\GeneratorManager;
use Symfony\Component\Process\Exception\ProcessFailedException;

beforeEach(function (): void {
});

it('throws `ProcessFailedException`', function (): void {
config('ai-commit')->set('generators.github_models_cli.binary', 'github-models-cli');
expect(app(GeneratorManager::class)->driver('github_models_cli'))->generate('error');
})->group(__DIR__, __FILE__)->throws(ProcessFailedException::class);

0 comments on commit 0ece92c

Please sign in to comment.