@@ -362,7 +362,7 @@ describe('Opportunities Controller', () => {
362362 } ) ;
363363
364364 // TODO: Complete tests for OpportunitiesController
365- it ( 'creates an opportunity with hardcoded tags merged with existing tags ' , async ( ) => {
365+ it ( 'creates an opportunity with type-specific tags only ' , async ( ) => {
366366 // Reset the stub to track calls
367367 mockOpportunity . create . resetHistory ( ) ;
368368
@@ -377,15 +377,15 @@ describe('Opportunities Controller', () => {
377377 expect ( opportunity ) . to . have . property ( 'id' , OPPORTUNITY_ID ) ;
378378 expect ( opportunity ) . to . have . property ( 'siteId' , SITE_ID ) ;
379379
380- // Verify that hardcoded tags were added to the create call
380+ // Verify that only type-specific tags are used
381381 const createCallData = mockOpportunity . create . getCall ( 0 ) . args [ 0 ] ;
382- expect ( createCallData ) . to . have . property ( 'tags' ) . that . includes ( 'automated' ) ;
383- expect ( createCallData ) . to . have . property ( 'tags' ) . that . includes ( 'spacecat' ) ;
384- expect ( createCallData ) . to . have . property ( ' tags' ) . that . includes ( 'tag1' ) ;
385- expect ( createCallData ) . to . have . property ( 'tags' ) . that . includes ( 'tag2 ') ;
382+ expect ( createCallData ) . to . have . property ( 'tags' ) ;
383+ // We no longer expect 'automated' or 'spacecat' tags
384+ // We also don't expect input tags to be included
385+ expect ( createCallData . tags ) . to . be . an ( 'array ') ;
386386 } ) ;
387387
388- it ( 'creates an opportunity with hardcoded tags when no tags exist' , async ( ) => {
388+ it ( 'creates an opportunity with type-specific tags when no tags exist' , async ( ) => {
389389 // Reset the stub to track calls
390390 mockOpportunity . create . resetHistory ( ) ;
391391
@@ -400,14 +400,14 @@ describe('Opportunities Controller', () => {
400400 expect ( mockOpportunityDataAccess . Opportunity . create . calledOnce ) . to . be . true ;
401401 expect ( response . status ) . to . equal ( 201 ) ;
402402
403- // Verify that only hardcoded tags were added to the create call
403+ // Verify that type-specific tags were added to the create call
404404 const createCallData = mockOpportunity . create . getCall ( 0 ) . args [ 0 ] ;
405- expect ( createCallData ) . to . have . property ( 'tags' ) . that . includes ( 'automated' ) ;
406- expect ( createCallData ) . to . have . property ( 'tags' ) . that . includes ( 'spacecat ') ;
407- expect ( createCallData . tags ) . to . have . lengthOf ( 2 ) ; // Only the hardcoded tags
405+ expect ( createCallData ) . to . have . property ( 'tags' ) ;
406+ expect ( createCallData . tags ) . to . be . an ( 'array ') ;
407+ // We no longer expect 'automated' or 'spacecat' tags
408408 } ) ;
409409
410- it ( 'updates an opportunity and preserves hardcoded tags' , async ( ) => {
410+ it ( 'updates an opportunity and uses only type-specific tags' , async ( ) => {
411411 // Create a spy for the setTags method
412412 const setTagsSpy = sandbox . spy ( mockOpptyEntity , 'setTags' ) ;
413413
@@ -436,13 +436,10 @@ describe('Opportunities Controller', () => {
436436 // Verify that setTags was called
437437 expect ( setTagsSpy . called ) . to . be . true ;
438438
439- // Verify the tags argument contains the expected values
439+ // Verify the tags argument is an array
440440 const tagsArgument = setTagsSpy . firstCall . args [ 0 ] ;
441- expect ( tagsArgument ) . to . include ( 'automated' ) ;
442- expect ( tagsArgument ) . to . include ( 'spacecat' ) ;
443- expect ( tagsArgument ) . to . include ( 'tag1' ) ;
444- expect ( tagsArgument ) . to . include ( 'tag2' ) ;
445- expect ( tagsArgument ) . to . include ( 'NEW' ) ;
441+ expect ( tagsArgument ) . to . be . an ( 'array' ) ;
442+ // We no longer expect input tags or 'automated'/'spacecat' tags
446443
447444 setTagsSpy . restore ( ) ;
448445
0 commit comments