jx/internal/resource/onerror_test.go
Matthew Rich 432a9472fe
Some checks failed
Lint / golangci-lint (push) Has been cancelled
Declarative Tests / test (push) Has been cancelled
Declarative Tests / build-fedora (push) Has been cancelled
Declarative Tests / build-ubuntu-focal (push) Has been cancelled
add onerror strategy
2024-09-15 17:16:00 +00:00

22 lines
617 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package resource
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestOnErrorStrategies(t *testing.T) {
for _, v := range []struct{ strategy OnError; expected OnError; validate error }{
{ strategy: OnErrorFail, expected: "fail", validate: nil },
{ strategy: OnErrorSkip, expected: "skip", validate: nil },
{ strategy: OnError("unknown"), expected: "", validate: ErrInvalidOnErrorStrategy },
}{
o := v.strategy
assert.Equal(t, v.expected, o.Strategy())
assert.ErrorIs(t, o.Validate(), v.validate)
}
}