@@ -41,7 +41,6 @@ describe('integration: add and remove resources', () => {
4141 const found = memories ! . some ( ( m : Record < string , unknown > ) => m . name === memoryName ) ;
4242 expect ( found , `Memory "${ memoryName } " should be in config` ) . toBe ( true ) ;
4343
44- // Verify telemetry
4544 telemetry . assertMetricEmitted ( { command : 'add.memory' , exit_reason : 'success' } ) ;
4645 } ) ;
4746
@@ -71,7 +70,6 @@ describe('integration: add and remove resources', () => {
7170 expect ( episodic ! . reflectionNamespaces , 'Should have reflectionNamespaces' ) . toBeDefined ( ) ;
7271 expect ( episodic ! . reflectionNamespaces ! . length ) . toBeGreaterThan ( 0 ) ;
7372
74- // Verify telemetry
7573 telemetry . assertMetricEmitted ( {
7674 command : 'add.memory' ,
7775 exit_reason : 'success' ,
@@ -84,7 +82,9 @@ describe('integration: add and remove resources', () => {
8482 } ) ;
8583
8684 it ( 'removes the memory resource' , async ( ) => {
87- const result = await runCLI ( [ 'remove' , 'memory' , '--name' , memoryName , '--json' ] , project . projectPath ) ;
85+ const result = await runCLI ( [ 'remove' , 'memory' , '--name' , memoryName , '--json' ] , project . projectPath , {
86+ env : telemetry . env ,
87+ } ) ;
8888
8989 expect ( result . exitCode , `stdout: ${ result . stdout } , stderr: ${ result . stderr } ` ) . toBe ( 0 ) ;
9090 const json = JSON . parse ( result . stdout ) ;
@@ -95,6 +95,8 @@ describe('integration: add and remove resources', () => {
9595 const memories = ( config . memories as Record < string , unknown > [ ] | undefined ) ?? [ ] ;
9696 const found = memories . some ( ( m : Record < string , unknown > ) => m . name === memoryName ) ;
9797 expect ( found , `Memory "${ memoryName } " should be removed from config` ) . toBe ( false ) ;
98+
99+ telemetry . assertMetricEmitted ( { command : 'remove.memory' , exit_reason : 'success' } ) ;
98100 } ) ;
99101 } ) ;
100102
@@ -119,7 +121,6 @@ describe('integration: add and remove resources', () => {
119121 const found = credentials ! . some ( ( c : Record < string , unknown > ) => c . name === credentialName ) ;
120122 expect ( found , `Credential "${ credentialName } " should be in config` ) . toBe ( true ) ;
121123
122- // Verify telemetry
123124 telemetry . assertMetricEmitted ( {
124125 command : 'add.credential' ,
125126 exit_reason : 'success' ,
@@ -128,7 +129,9 @@ describe('integration: add and remove resources', () => {
128129 } ) ;
129130
130131 it ( 'removes the credential resource' , async ( ) => {
131- const result = await runCLI ( [ 'remove' , 'credential' , '--name' , credentialName , '--json' ] , project . projectPath ) ;
132+ const result = await runCLI ( [ 'remove' , 'credential' , '--name' , credentialName , '--json' ] , project . projectPath , {
133+ env : telemetry . env ,
134+ } ) ;
132135
133136 expect ( result . exitCode , `stdout: ${ result . stdout } , stderr: ${ result . stderr } ` ) . toBe ( 0 ) ;
134137 const json = JSON . parse ( result . stdout ) ;
@@ -139,6 +142,8 @@ describe('integration: add and remove resources', () => {
139142 const credentials = ( config . credentials as Record < string , unknown > [ ] | undefined ) ?? [ ] ;
140143 const found = credentials . some ( ( c : Record < string , unknown > ) => c . name === credentialName ) ;
141144 expect ( found , `Credential "${ credentialName } " should be removed from config` ) . toBe ( false ) ;
145+
146+ telemetry . assertMetricEmitted ( { command : 'remove.credential' , exit_reason : 'success' } ) ;
142147 } ) ;
143148 } ) ;
144149
@@ -162,9 +167,13 @@ describe('integration: add and remove resources', () => {
162167 } ) ;
163168
164169 it ( 'removes the policy engine resource' , async ( ) => {
165- const result = await runCLI ( [ 'remove' , 'policy-engine' , '--name' , engineName , '--json' ] , project . projectPath ) ;
170+ const result = await runCLI ( [ 'remove' , 'policy-engine' , '--name' , engineName , '--json' ] , project . projectPath , {
171+ env : telemetry . env ,
172+ } ) ;
166173
167174 expect ( result . exitCode , `stdout: ${ result . stdout } , stderr: ${ result . stderr } ` ) . toBe ( 0 ) ;
175+
176+ telemetry . assertMetricEmitted ( { command : 'remove.policy-engine' , exit_reason : 'success' } ) ;
168177 } ) ;
169178 } ) ;
170179} ) ;
0 commit comments