@@ -15,6 +15,7 @@ class ParameterStoreBuildWrapperPluginTest {
1515 public class Init {
1616 @After
1717 void resetPlugins () {
18+ TerraformValidateStage . resetPlugins()
1819 TerraformEnvironmentStage . reset()
1920 }
2021
@@ -25,6 +26,14 @@ class ParameterStoreBuildWrapperPluginTest {
2526 Collection actualPlugins = TerraformEnvironmentStage . getPlugins()
2627 assertThat (actualPlugins, hasItem(instanceOf(ParameterStoreBuildWrapperPlugin . class)))
2728 }
29+
30+ @Test
31+ void modifiesTerraformValidateStageCommand () {
32+ ParameterStoreBuildWrapperPlugin . init()
33+
34+ Collection actualPlugins = TerraformValidateStage . getPlugins()
35+ assertThat (actualPlugins, hasItem(instanceOf(ParameterStoreBuildWrapperPlugin . class)))
36+ }
2837 }
2938
3039 public class PathForEnvironment {
@@ -92,10 +101,29 @@ class ParameterStoreBuildWrapperPluginTest {
92101 }
93102
94103 @Test
95- void addsGlobalParameter () {
104+ void addGlobalParameter () {
96105 def result = ParameterStoreBuildWrapperPlugin . withGlobalParameter(' /path/' , [])
97106
98- assertEquals (ParameterStoreBuildWrapperPlugin . class, result)
107+ assertEquals ([[path : ' /path/' ]], result. globalParameterOptions)
108+ }
109+
110+ @Test
111+ void addGlobalParameterWithOptions () {
112+ def result = ParameterStoreBuildWrapperPlugin . withGlobalParameter(' /path/' , [recursive : true , basename : ' relative' ])
113+
114+ assertEquals ([[path : ' /path/' , recursive : true , basename : ' relative' ]], result. globalParameterOptions)
115+ }
116+
117+ @Test
118+ void addMulitpleGlobalParameters () {
119+ ArrayList expected = []
120+ def result = ParameterStoreBuildWrapperPlugin . withGlobalParameter(' /path/' , [])
121+ .withGlobalParameter(' /path2/' , [recursive : true ])
122+ .withGlobalParameter(' /path3/' , [basename : ' something' ])
123+ expected << [path :' /path/' ]
124+ expected << [path : ' /path2/' , recursive : true ]
125+ expected << [path : ' /path3/' , basename : ' something' ]
126+ assertEquals (expected, result. globalParameterOptions)
99127 }
100128 }
101129}
0 commit comments