nomino/make_test.go
Dan Jones 7126ef97a4 Add Make function
This is the important one
2025-03-10 14:53:59 -05:00

23 lines
502 B
Go

package nomino
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMake(t *testing.T) {
conf := NewConfig(WithGenerator(func() (string, error) { return "abc", nil }))
st, err := Make(conf)
assert.NoError(t, err)
assert.Equal(t, "abc", st)
}
func TestMakeErr(t *testing.T) {
retErr := errors.New("oops")
conf := NewConfig(WithGenerator(func() (string, error) { return "foobar", retErr }))
st, err := Make(conf)
assert.Zero(t, st)
assert.ErrorIs(t, err, retErr)
}