Skip to content

Commit

Permalink
removed unused function & duplicate test
Browse files Browse the repository at this point in the history
  • Loading branch information
codezninja committed Sep 23, 2020
1 parent fdd4b54 commit 84d5cfc
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions test/ParameterStoreBuildWrapperPluginTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,9 @@ class ParameterStoreBuildWrapperPluginTest {
public class Apply {
@After
public void reset() {
Jenkinsfile.instance = null
ParameterStoreBuildWrapperPlugin.reset()
}

private configureJenkins(Map config = [:]) {
Jenkinsfile.instance = mock(Jenkinsfile.class)
when(Jenkinsfile.instance.getStandardizedRepoSlug()).thenReturn(config.repoSlug)
when(Jenkinsfile.instance.getRepoName()).thenReturn(config.repoName ?: 'repo')
when(Jenkinsfile.instance.getOrganization()).thenReturn(config.organization ?: 'org')
when(Jenkinsfile.instance.getEnv()).thenReturn(config.env ?: [:])
}

class WithTerraformValidateStage {
@Test
void doesNotDecorateTheTerraformValidateStageIfGlobalParametersNotSet() {
Expand Down Expand Up @@ -147,32 +138,9 @@ class ParameterStoreBuildWrapperPluginTest {
class GetParameterOptions {
@After
public void reset() {
Jenkinsfile.instance = null
ParameterStoreBuildWrapperPlugin.reset()
}

private configureJenkins(Map config = [:]) {
Jenkinsfile.instance = mock(Jenkinsfile.class)
when(Jenkinsfile.instance.getStandardizedRepoSlug()).thenReturn(config.repoSlug)
when(Jenkinsfile.instance.getRepoName()).thenReturn(config.repoName ?: 'repo')
when(Jenkinsfile.instance.getOrganization()).thenReturn(config.organization ?: 'org')
when(Jenkinsfile.instance.getEnv()).thenReturn(config.env ?: [:])
}

@Test
void returnsNoOptionsWhenNotSet() {
String environment = "MyEnv"
Map option = [:]
List expected = [ option ]
ParameterStoreBuildWrapperPlugin plugin = spy(new ParameterStoreBuildWrapperPlugin())

doReturn(option).when(plugin).getEnvironmentParameterOptions(environment)

List actual = plugin.getParameterOptions(environment)

assertEquals(expected, actual)
}

@Test
void returnsEnvironmentOptionWhenSet() {
String environment = "MyEnv"
Expand Down

0 comments on commit 84d5cfc

Please sign in to comment.