/
githubmirror
/
act
Обзор
Документация
Войти
/
githubmirror
/
act
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/runner/step_factory_test.go
81 строка
1 KB
Markus Wolf
feat: split job steps into its own files/structs (#1004)
23 мар 2022, 00:13
Не верифицирован
23 мар 2022, 00:13
2bb3e74
Код
Авторство
О чём код?
package runner import ( "testing" "github.com/nektos/act/pkg/model" "github.com/stretchr/testify/assert" ) func TestStepFactoryNewStep(t *testing.T) { table := []struct { name string model *model.Step check func(s step) bool }{ { name: "StepRemoteAction", model: &model.Step{ Uses: "remote/action@v1", }, check: func(s step) bool { _, ok := s.(*stepActionRemote) return ok }, }, { name: "StepLocalAction", model: &model.Step{ Uses: "./action@v1", }, check: func(s step) bool { _, ok := s.(*stepActionLocal) return ok }, }, { name: "StepDocker", model: &model.Step{ Uses: "docker://image:tag", }, check: func(s step) bool { _, ok := s.(*stepDocker) return ok }, }, { name: "StepRun", model: &model.Step{ Run: "cmd", }, check: func(s step) bool { _, ok := s.(*stepRun) return ok }, }, } for _, tt := range table { t.Run(tt.name, func(t *testing.T) { sf := &stepFactoryImpl{} step, err := sf.newStep(tt.model, &RunContext{}) assert.True(t, tt.check((step))) assert.Nil(t, err) }) } } func TestStepFactoryInvalidStep(t *testing.T) { model := &model.Step{ Uses: "remote/action@v1", Run: "cmd", } sf := &stepFactoryImpl{} _, err := sf.newStep(model, &RunContext{}) assert.Error(t, err) }