2023-06-07 09:44:50 -08:00
|
|
|
package strings_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
2023-08-18 13:55:43 -05:00
|
|
|
"github.com/coder/coder/v2/coderd/util/strings"
|
2023-06-07 09:44:50 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestJoinWithConjunction(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
require.Equal(t, "foo", strings.JoinWithConjunction([]string{"foo"}))
|
|
|
|
|
require.Equal(t, "foo and bar", strings.JoinWithConjunction([]string{"foo", "bar"}))
|
|
|
|
|
require.Equal(t, "foo, bar and baz", strings.JoinWithConjunction([]string{"foo", "bar", "baz"}))
|
|
|
|
|
}
|