Install selected modules

This commit is contained in:
Rezart Qelibari
2022-02-11 16:05:02 +01:00
parent fee0acec8b
commit 4e78a763ca
3 changed files with 144 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
Describe 'installModules'
Include ./install.sh
output=()
runModule() { output=("$@") }
It 'does nothing if modules array is empty'
declare -A modulesToInstall=() answers=()
called=false
generateModuleOptions() { called=true }
When call installModules
The output should eq ''
The variable 'called' should eq 'false'
The status should be success
End
It 'calls the module without options if answers is empty'
declare -A answers=()
modulesToInstall=('/modules/my module')
When call installModules
The output should eq ''
The variable 'output[1]' should eq '/modules/my module'
The status should be success
End
It 'calls the module with given answers as options'
declare -A answers=('/modules/my module_name' 'hercules')
modulesToInstall=('/modules/my module')
When call installModules
The output should eq ''
The variable 'output' should eq '/modules/my module --name hercules'
The variable 'output[1]' should eq '/modules/my module'
The variable 'output[2]' should eq '--name'
The variable 'output[3]' should eq 'hercules'
The status should be success
End
End