Skip to content

Commit

Permalink
Spec out default config for select module types, when prompt: false.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseleite committed Nov 2, 2024
1 parent ce21344 commit fbd18e2
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions tests/StarterKits/InstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand All @@ -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',
],
],
],
],
],
]);

Expand All @@ -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();

Expand All @@ -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]
Expand Down Expand Up @@ -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',
],
],
],
],
],
],
],
Expand All @@ -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();

Expand All @@ -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]
Expand Down

0 comments on commit fbd18e2

Please sign in to comment.