@@ -51,6 +51,14 @@ jest.mock('../../lib/cli/parse-command-line-arguments', () => ({
5151 if ( args . includes ( 'ts' ) ) {
5252 result = { ...result , language : 'typescript' } ;
5353 }
54+ } else if ( args . includes ( 'gc' ) ) {
55+ result = { ...result , _ : [ 'gc' ] } ;
56+
57+ // Handle role-arn flag for gc command validation testing
58+ // This simulates parser behavior to test that the CLI properly rejects roleArn
59+ if ( args . includes ( '--role-arn' ) ) {
60+ result = { ...result , roleArn : 'arn:aws:iam::123456789012:role/TestRole' } ;
61+ }
5462 }
5563
5664 // Handle notices flags
@@ -433,6 +441,9 @@ describe('gc command validation tests', () => {
433441 jest . clearAllMocks ( ) ;
434442 } ) ;
435443
444+ /**
445+ * Tests that the gc does not support roleArn
446+ */
436447 test ( 'should throw error when --role-arn is provided with gc command' , async ( ) => {
437448 // Mock configuration to include 'gc' in unstable features
438449 const mockConfig = {
@@ -450,7 +461,7 @@ describe('gc command validation tests', () => {
450461
451462 ( Configuration as any ) . mockImplementation ( ( ) => mockConfig ) ;
452463 Configuration . fromArgsAndFiles = jest . fn ( ) . mockImplementation ( ( ) => mockConfig ) ;
453-
464+ // Expects an error to be thrown when roleArn is used with gc
454465 await expect ( exec ( [ 'gc' , '--role-arn' , 'arn:aws:iam::123456789012:role/TestRole' , '--unstable=gc' ] ) )
455466 . rejects
456467 . toThrow ( 'The --role-arn option is not supported for the gc command' ) ;
0 commit comments