// Copyright 2024 Matthew Rich . 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) } }