jx/internal/folio/onerror_test.go
Matthew Rich 6e0049c4d2
Some checks are pending
Lint / golangci-lint (push) Waiting to run
Declarative Tests / test (push) Waiting to run
Declarative Tests / build-fedora (push) Waiting to run
Declarative Tests / build-ubuntu-focal (push) Waiting to run
add resource and document constraints
2024-09-19 07:57:26 +00:00

22 lines
623 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package folio
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, OnError(o.Strategy()))
assert.ErrorIs(t, o.Validate(), v.validate)
}
}