@@ -585,3 +585,133 @@ func TestCompleteInheritance(t *testing.T) {
585585 assert .Contains (t , component .Variables , "production_branch = \" production\" " )
586586 assert .Contains (t , component .Variables , "vercel_project_manual_production_deployment = true" )
587587}
588+
589+ func TestManualProductionDeploymentBehavior (t * testing.T ) {
590+ t .Run ("defaults to false when not specified" , func (t * testing.T ) {
591+ plugin := NewVercelPlugin ()
592+
593+ data := map [string ]any {
594+ "team_id" : "test-team" ,
595+ "api_token" : "test-token" ,
596+ "project_config" : map [string ]any {
597+ "framework" : "nextjs" ,
598+ },
599+ }
600+
601+ err := plugin .SetSiteConfig ("my-site" , data )
602+ require .NoError (t , err )
603+
604+ component , err := plugin .RenderTerraformComponent ("my-site" , "test-component" )
605+ require .NoError (t , err )
606+
607+ assert .Contains (t , component .Variables , "vercel_project_manual_production_deployment = false" )
608+ })
609+
610+ t .Run ("explicit false is preserved" , func (t * testing.T ) {
611+ plugin := NewVercelPlugin ()
612+
613+ data := map [string ]any {
614+ "team_id" : "test-team" ,
615+ "api_token" : "test-token" ,
616+ "project_config" : map [string ]any {
617+ "framework" : "nextjs" ,
618+ "manual_production_deployment" : false ,
619+ },
620+ }
621+
622+ err := plugin .SetSiteConfig ("my-site" , data )
623+ require .NoError (t , err )
624+
625+ component , err := plugin .RenderTerraformComponent ("my-site" , "test-component" )
626+ require .NoError (t , err )
627+
628+ assert .Contains (t , component .Variables , "vercel_project_manual_production_deployment = false" )
629+ })
630+
631+ t .Run ("inheritance: child overrides parent" , func (t * testing.T ) {
632+ plugin := NewVercelPlugin ()
633+
634+ globalData := map [string ]any {
635+ "team_id" : "test-team" ,
636+ "api_token" : "test-token" ,
637+ "project_config" : map [string ]any {
638+ "manual_production_deployment" : false ,
639+ },
640+ }
641+
642+ siteData := map [string ]any {
643+ "project_config" : map [string ]any {
644+ "manual_production_deployment" : true ,
645+ },
646+ }
647+
648+ err := plugin .SetGlobalConfig (globalData )
649+ require .NoError (t , err )
650+
651+ err = plugin .SetSiteConfig ("my-site" , siteData )
652+ require .NoError (t , err )
653+
654+ component , err := plugin .RenderTerraformComponent ("my-site" , "test-component" )
655+ require .NoError (t , err )
656+
657+ assert .Contains (t , component .Variables , "vercel_project_manual_production_deployment = true" )
658+ })
659+
660+ t .Run ("inheritance: inherits false when not specified" , func (t * testing.T ) {
661+ plugin := NewVercelPlugin ()
662+
663+ globalData := map [string ]any {
664+ "team_id" : "test-team" ,
665+ "api_token" : "test-token" ,
666+ "project_config" : map [string ]any {
667+ "manual_production_deployment" : false ,
668+ },
669+ }
670+
671+ siteData := map [string ]any {
672+ "project_config" : map [string ]any {
673+ "framework" : "nextjs" ,
674+ },
675+ }
676+
677+ err := plugin .SetGlobalConfig (globalData )
678+ require .NoError (t , err )
679+
680+ err = plugin .SetSiteConfig ("my-site" , siteData )
681+ require .NoError (t , err )
682+
683+ component , err := plugin .RenderTerraformComponent ("my-site" , "test-component" )
684+ require .NoError (t , err )
685+
686+ assert .Contains (t , component .Variables , "vercel_project_manual_production_deployment = false" )
687+ })
688+
689+ t .Run ("inheritance: inherits true when not specified" , func (t * testing.T ) {
690+ plugin := NewVercelPlugin ()
691+
692+ globalData := map [string ]any {
693+ "team_id" : "test-team" ,
694+ "api_token" : "test-token" ,
695+ "project_config" : map [string ]any {
696+ "manual_production_deployment" : true ,
697+ },
698+ }
699+
700+ siteData := map [string ]any {
701+ "project_config" : map [string ]any {
702+ "framework" : "nextjs" ,
703+ },
704+ }
705+
706+ err := plugin .SetGlobalConfig (globalData )
707+ require .NoError (t , err )
708+
709+ err = plugin .SetSiteConfig ("my-site" , siteData )
710+ require .NoError (t , err )
711+
712+ component , err := plugin .RenderTerraformComponent ("my-site" , "test-component" )
713+ require .NoError (t , err )
714+
715+ assert .Contains (t , component .Variables , "vercel_project_manual_production_deployment = true" )
716+ })
717+ }
0 commit comments