Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Add initial tests for scale state. #6

Merged
merged 1 commit into from
Dec 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions pkg/state/scale_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package state

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestScaleDirection_String(t *testing.T) {
testCases := []struct {
inputScaleDirection ScaleDirection
expectedOutput string
name string
}{
{
inputScaleDirection: ScaleDirectionIn,
expectedOutput: "in",
},
{
inputScaleDirection: ScaleDirectionOut,
expectedOutput: "out",
},
{
inputScaleDirection: ScaleDirectionNone,
expectedOutput: "none",
},
}

for _, tc := range testCases {
actualOutput := tc.inputScaleDirection.String()
assert.Equal(t, tc.expectedOutput, actualOutput, tc.name)
}
}

func TestScaleStatus_String(t *testing.T) {
testCases := []struct {
inputScaleStatus ScaleStatus
expectedOutput string
name string
}{
{
inputScaleStatus: ScaleStatusStarted,
expectedOutput: "started",
},
{
inputScaleStatus: ScaleStatusInProgress,
expectedOutput: "in-progress",
},
{
inputScaleStatus: ScaleStatusCompleted,
expectedOutput: "completed",
},
{
inputScaleStatus: ScaleStatusFailed,
expectedOutput: "failed",
},
}

for _, tc := range testCases {
actualOutput := tc.inputScaleStatus.String()
assert.Equal(t, tc.expectedOutput, actualOutput, tc.name)
}
}