From fbd18e2d7720567a6be49cda2e8280e62d400cb7 Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Sat, 2 Nov 2024 18:04:14 -0400 Subject: [PATCH] Spec out `default` config for select module types, when `prompt: false`. --- tests/StarterKits/InstallTest.php | 60 +++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/tests/StarterKits/InstallTest.php b/tests/StarterKits/InstallTest.php index 10c85e1c2e..4fcdb8832c 100644 --- a/tests/StarterKits/InstallTest.php +++ b/tests/StarterKits/InstallTest.php @@ -780,7 +780,7 @@ public function it_installs_modules_with_prompt_false_config_by_default_when_run ], 'modules' => [ 'seo' => [ - 'prompt' => false, // Setting prompt to false skips confirmation, so this module should still get installed non-interactively + 'prompt' => false, // Setting prompt to false skips confirmation, so this module should still get installed 'export_paths' => [ 'resources/css/seo.css', ], @@ -797,11 +797,39 @@ public function it_installs_modules_with_prompt_false_config_by_default_when_run ], ], 'jamaica' => [ - 'prompt' => false, // Setting prompt to false skips confirmation, so this module should still get installed non-interactively + 'prompt' => false, // Setting prompt to false skips confirmation, so this module should still get installed 'export_as' => [ 'resources/css/theme.css' => 'resources/css/jamaica.css', ], ], + 'js' => [ + 'prompt' => false, // Setting prompt to false skips confirmation, so this module should still get installed + 'default' => 'vue', // And a `default` is required so that we know which one to install + 'options' => [ + 'react' => [ + 'label' => 'React JS', + 'export_paths' => [ + 'resources/js/react.js', + ], + ], + 'vue' => [ + 'label' => 'Vue JS', + 'export_paths' => [ + 'resources/js/vue.js', + ], + ], + ], + ], + 'js_invalid' => [ + 'prompt' => false, // Setting prompt to false without a `default`, is not valid config + 'options' => [ + 'svelte' => [ + 'export_paths' => [ + 'resources/js/svelte.js', + ], + ], + ], + ], ], ]); @@ -811,6 +839,9 @@ public function it_installs_modules_with_prompt_false_config_by_default_when_run $this->assertFileDoesNotExist(base_path('resources/css/theme.css')); $this->assertComposerJsonDoesntHave('statamic/seo-pro'); $this->assertComposerJsonDoesntHave('bobsled/speed-calculator'); + $this->assertFileDoesNotExist(base_path('resources/js/react.js')); + $this->assertFileDoesNotExist(base_path('resources/js/vue.js')); + $this->assertFileDoesNotExist(base_path('resources/js/svelte.js')); $this->installCoolRunnings(); @@ -820,6 +851,9 @@ public function it_installs_modules_with_prompt_false_config_by_default_when_run $this->assertFileExists(base_path('resources/css/theme.css')); $this->assertComposerJsonHasPackageVersion('require', 'statamic/seo-pro', '^0.2.0'); $this->assertComposerJsonDoesntHave('bobsled/speed-calculator'); + $this->assertFileDoesNotExist(base_path('resources/js/react.js')); + $this->assertFileExists(base_path('resources/js/vue.js')); + $this->assertFileDoesNotExist(base_path('resources/js/svelte.js')); } #[Test] @@ -1179,6 +1213,24 @@ public function it_installs_nested_modules_with_prompt_false_config_by_default_w 'resources/dictionaries/canadian_players.yaml', ], ], + 'js' => [ + 'prompt' => false, // Setting prompt to false skips confirmation, so this module should still get installed + 'default' => 'vue', // And a `default` is required so that we know which one to install + 'options' => [ + 'react' => [ + 'label' => 'React JS', + 'export_paths' => [ + 'resources/js/react.js', + ], + ], + 'vue' => [ + 'label' => 'Vue JS', + 'export_paths' => [ + 'resources/js/vue.js', + ], + ], + ], + ], ], ], ], @@ -1192,6 +1244,8 @@ public function it_installs_nested_modules_with_prompt_false_config_by_default_w $this->assertFileDoesNotExist(base_path('resources/dictionaries/players.yaml')); $this->assertFileDoesNotExist(base_path('resources/dictionaries/american_players.yaml')); $this->assertFileDoesNotExist(base_path('resources/dictionaries/canadian_players.yaml')); + $this->assertFileDoesNotExist(base_path('resources/js/react.js')); + $this->assertFileDoesNotExist(base_path('resources/js/vue.js')); $this->installCoolRunnings(); @@ -1201,6 +1255,8 @@ public function it_installs_nested_modules_with_prompt_false_config_by_default_w $this->assertFileExists(base_path('resources/dictionaries/players.yaml')); $this->assertFileDoesNotExist(base_path('resources/dictionaries/american_players.yaml')); $this->assertFileExists(base_path('resources/dictionaries/canadian_players.yaml')); + $this->assertFileDoesNotExist(base_path('resources/js/react.js')); + $this->assertFileExists(base_path('resources/js/vue.js')); } #[Test]