Instantiate a Lint when cfg.Command is "lint" [#3]

This commit is contained in:
Erin Call 2019-12-17 17:14:39 -08:00
parent a6a2d6e6a3
commit 7e24756ad8
No known key found for this signature in database
GPG key ID: 4071FF6C15B8DAD1
2 changed files with 32 additions and 1 deletions

View file

@ -62,7 +62,7 @@ func determineSteps(cfg Config) *func(Config) []Step {
case "delete": case "delete":
panic("not implemented") panic("not implemented")
case "lint": case "lint":
panic("not implemented") return &lint
case "help": case "help":
return &help return &help
default: default:
@ -116,6 +116,14 @@ var upgrade = func(cfg Config) []Step {
return steps return steps
} }
var lint = func(cfg Config) []Step {
lint := &run.Lint{
Chart: cfg.Chart,
}
return []Step{lint}
}
var help = func(cfg Config) []Step { var help = func(cfg Config) []Step {
help := &run.Help{} help := &run.Help{}
return []Step{help} return []Step{help}

View file

@ -137,6 +137,20 @@ func (suite *PlanTestSuite) TestUpgrade() {
suite.Equal(expected, upgrade) suite.Equal(expected, upgrade)
} }
func (suite *PlanTestSuite) TestLint() {
cfg := Config{
Chart: "./flow",
}
steps := lint(cfg)
suite.Equal(1, len(steps))
want := &run.Lint{
Chart: "./flow",
}
suite.Equal(want, steps[0])
}
func (suite *PlanTestSuite) TestDeterminePlanUpgradeCommand() { func (suite *PlanTestSuite) TestDeterminePlanUpgradeCommand() {
cfg := Config{ cfg := Config{
Command: "upgrade", Command: "upgrade",
@ -156,6 +170,15 @@ func (suite *PlanTestSuite) TestDeterminePlanUpgradeFromDroneEvent() {
} }
} }
func (suite *PlanTestSuite) TestDeterminePlanLintCommand() {
cfg := Config{
Command: "lint",
}
stepsMaker := determineSteps(cfg)
suite.Same(&lint, stepsMaker)
}
func (suite *PlanTestSuite) TestDeterminePlanHelpCommand() { func (suite *PlanTestSuite) TestDeterminePlanHelpCommand() {
cfg := Config{ cfg := Config{
Command: "help", Command: "help",