@@ -366,6 +366,7 @@ func Test_Create_installProjectDependencies(t *testing.T) {
366366 experiments []string
367367 runtime string
368368 manifestSource config.ManifestSource
369+ expectedManifestSource config.ManifestSource
369370 existingFiles map [string ]string
370371 expectedOutputs []string
371372 unexpectedOutputs []string
@@ -418,24 +419,38 @@ func Test_Create_installProjectDependencies(t *testing.T) {
418419 },
419420 "When no manifest source, default to project (local)" : {
420421 expectedOutputs : []string {
421- `Updated config.json manifest source to "project" (local)` ,
422+ `Updated app manifest source to "project" (local)` ,
422423 },
423424 },
424- "When manifest source is provided, should set it" : {
425- manifestSource : config .ManifestSourceRemote ,
425+ "When remote manifest source is provided, should use it" : {
426+ manifestSource : config .ManifestSourceRemote ,
427+ expectedManifestSource : config .ManifestSourceRemote ,
428+ existingFiles : map [string ]string {
429+ ".slack/hooks.json" : "{}" ,
430+ },
431+ expectedOutputs : []string {
432+ `Updated app manifest source to "app settings" (remote)` ,
433+ },
434+ },
435+ "When local manifest source is provided, should use it" : {
436+ manifestSource : config .ManifestSourceLocal ,
437+ expectedManifestSource : config .ManifestSourceLocal ,
438+ existingFiles : map [string ]string {
439+ ".slack/hooks.json" : "{}" ,
440+ },
426441 expectedOutputs : []string {
427- `Updated config.json manifest source to "app settings " (remote )` ,
442+ `Updated app manifest source to "project " (local )` ,
428443 },
429444 },
430445 "When Deno project, should set manifest source to project (local)" : {
431446 expectedOutputs : []string {
432- `Updated config.json manifest source to "project" (local)` ,
447+ `Updated app manifest source to "project" (local)` ,
433448 },
434449 },
435- "When non-Deno project, should set manifest source to app settings (remote )" : {
450+ "When non-Deno project, should set manifest source to project (local )" : {
436451 runtime : "node" ,
437452 expectedOutputs : []string {
438- `Updated config.json manifest source to "app settings " (remote )` ,
453+ `Updated app manifest source to "project " (local )` ,
439454 },
440455 },
441456 }
@@ -490,8 +505,15 @@ func Test_Create_installProjectDependencies(t *testing.T) {
490505 }
491506 }
492507
508+ // Set manifest source
509+ if tc .manifestSource != "" {
510+ if err := config .SetManifestSource (ctx , clientsMock .Fs , clientsMock .Os , tc .manifestSource ); err != nil {
511+ require .FailNow (t , fmt .Sprintf ("Failed to set the manifest source in the memory-based file system: %s" , err ))
512+ }
513+ }
514+
493515 // Run the test
494- outputs := InstallProjectDependencies (ctx , clients , projectDirPath , tc . manifestSource )
516+ outputs := InstallProjectDependencies (ctx , clients , projectDirPath )
495517
496518 // Assertions
497519 for _ , expectedOutput := range tc .expectedOutputs {
@@ -503,6 +525,13 @@ func Test_Create_installProjectDependencies(t *testing.T) {
503525 for _ , expectedVerboseOutput := range tc .expectedVerboseOutputs {
504526 clientsMock .IO .AssertCalled (t , "PrintDebug" , mock .Anything , expectedVerboseOutput , tc .expectedVerboseArgs )
505527 }
528+ if tc .expectedManifestSource != "" {
529+ actualManifestSource , err := clients .Config .ProjectConfig .GetManifestSource (ctx )
530+ if err != nil {
531+ require .FailNow (t , fmt .Sprintf ("Failed to get the manifest source: %s" , err ))
532+ }
533+ assert .Equal (t , tc .expectedManifestSource , actualManifestSource )
534+ }
506535 assert .NotEmpty (t , clients .Config .ProjectID , "config.project_id" )
507536 // output := clientsMock.GetCombinedOutput()
508537 // assert.Contains(t, output, tc.expectedOutputs)
0 commit comments