|
401 | 401 | }); |
402 | 402 | }); |
403 | 403 |
|
| 404 | + describe('filtering options', function () { |
| 405 | + it('accepts only option for filtering keys', function () { |
| 406 | + $commandTester = runCommand('export', [ |
| 407 | + '--only' => 'API_*', |
| 408 | + '--stage' => 'testing', |
| 409 | + ]); |
| 410 | + |
| 411 | + $output = stripAnsi($commandTester->getDisplay()); |
| 412 | + |
| 413 | + // Should accept --only option without validation error |
| 414 | + expect($output)->not->toMatch('/(invalid.*option|unknown.*option)/i'); |
| 415 | + expect($commandTester->getStatusCode())->toBeGreaterThanOrEqual(0); |
| 416 | + }); |
| 417 | + |
| 418 | + it('accepts except option for excluding keys', function () { |
| 419 | + $commandTester = runCommand('export', [ |
| 420 | + '--except' => 'SECRET_*', |
| 421 | + '--stage' => 'testing', |
| 422 | + ]); |
| 423 | + |
| 424 | + $output = stripAnsi($commandTester->getDisplay()); |
| 425 | + |
| 426 | + // Should accept --except option without validation error |
| 427 | + expect($output)->not->toMatch('/(invalid.*option|unknown.*option)/i'); |
| 428 | + expect($commandTester->getStatusCode())->toBeGreaterThanOrEqual(0); |
| 429 | + }); |
| 430 | + |
| 431 | + it('accepts both only and except options together', function () { |
| 432 | + $commandTester = runCommand('export', [ |
| 433 | + '--only' => 'API_*,DB_*', |
| 434 | + '--except' => 'SECRET_*', |
| 435 | + '--stage' => 'testing', |
| 436 | + '--format' => 'json', |
| 437 | + ]); |
| 438 | + |
| 439 | + $output = stripAnsi($commandTester->getDisplay()); |
| 440 | + |
| 441 | + // Should accept both filtering options without error |
| 442 | + expect($output)->not->toMatch('/(invalid.*option|unknown.*option)/i'); |
| 443 | + expect($commandTester->getStatusCode())->toBeGreaterThanOrEqual(0); |
| 444 | + }); |
| 445 | + |
| 446 | + it('combines filtering with other options correctly', function () { |
| 447 | + $commandTester = runCommand('export', [ |
| 448 | + '--only' => 'APP_*', |
| 449 | + '--format' => 'env', |
| 450 | + '--vault' => 'test', |
| 451 | + '--stage' => 'testing', |
| 452 | + ]); |
| 453 | + |
| 454 | + $output = stripAnsi($commandTester->getDisplay()); |
| 455 | + |
| 456 | + // Should handle filtering with other options |
| 457 | + expect($output)->not->toMatch('/(invalid.*option|unknown.*option)/i'); |
| 458 | + expect($commandTester->getStatusCode())->toBeGreaterThanOrEqual(0); |
| 459 | + }); |
| 460 | + }); |
| 461 | + |
404 | 462 | // Tests migrated from Laravel-style tests to new architecture. |
405 | 463 | // Focus on command structure, parameter validation, file handling, and format options |
406 | 464 | // rather than full integration tests that depend on external AWS services and pre-populated data. |
|
0 commit comments