mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 08:32:16 +01:00
21 lines
428 B
Go
21 lines
428 B
Go
package xassert
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/thecodingmachine/gotenberg/test/internalpkg/xerrortest"
|
|
)
|
|
|
|
func TestStringOfOne(t *testing.T) {
|
|
rule := StringOneOf([]string{"foo", "bar", "baz"})
|
|
// should be OK.
|
|
rule.with("FOO", "foo")
|
|
err := rule.validate()
|
|
assert.Nil(t, err)
|
|
// should not be OK.
|
|
rule.with("FOO", "qux")
|
|
err = rule.validate()
|
|
xerrortest.AssertError(t, err)
|
|
}
|