♻️ Replace testify with be for tests

This commit is contained in:
Dan Jones 2025-09-26 20:23:32 -05:00
commit 4d723077e1
8 changed files with 79 additions and 91 deletions

View file

@ -4,28 +4,28 @@ import (
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/nalgeon/be"
)
func TestNewConf(t *testing.T) {
c := NewConfig()
assert.Equal(t, ".txt", c.extension)
be.Equal(t, c.extension, ".txt")
st, _ := c.generator(&c)
_, parseErr := uuid.Parse(st)
assert.NoError(t, parseErr)
be.Err(t, parseErr, nil)
}
func TestNewConfWithOpts(t *testing.T) {
c := NewConfig(WithoutExtension(), WithPrefix("foobar"))
assert.Equal(t, "", c.extension)
assert.Equal(t, "foobar", c.prefix)
be.Equal(t, c.extension, "")
be.Equal(t, c.prefix, "foobar")
}
func TestConfAddOpts(t *testing.T) {
c := Config{original: "hi"}
c2 := c.AddOptions(WithOriginalSlug("Hello, my dear"), WithPrefix("yo"))
assert.Equal(t, "", c.prefix)
assert.Equal(t, "hi", c.original)
assert.Equal(t, "hello-my-dear", c2.original)
assert.Equal(t, "yo", c2.prefix)
be.Equal(t, c.prefix, "")
be.Equal(t, c.original, "hi")
be.Equal(t, c2.original, "hello-my-dear")
be.Equal(t, c2.prefix, "yo")
}