From 0ece92c4bcd8617766267f6f2c2ac432a96867d6 Mon Sep 17 00:00:00 2001 From: "ityaozm@gmail.com" Date: Sat, 2 Nov 2024 13:57:09 +0800 Subject: [PATCH] test(github-models-cli): Add test for ProcessFailedException - 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 --- .../GithubModelsCliGeneratorTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/Unit/Generators/GithubModelsCliGeneratorTest.php diff --git a/tests/Unit/Generators/GithubModelsCliGeneratorTest.php b/tests/Unit/Generators/GithubModelsCliGeneratorTest.php new file mode 100644 index 0000000..188d098 --- /dev/null +++ b/tests/Unit/Generators/GithubModelsCliGeneratorTest.php @@ -0,0 +1,30 @@ + + * + * 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);