aboutsummaryrefslogtreecommitdiff
path: root/pkg/util/utils_test.go
blob: f47c0b7ad581f93339044d66205072ef0ce9f418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package util

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

var (
	sliceData = []string{"one", "two", "three", "four"}
)

func TestStringInSlice(t *testing.T) {
	// string is in the slice
	assert.True(t, StringInSlice("one", sliceData))
	// string is not in the slice
	assert.False(t, StringInSlice("five", sliceData))
	// string is not in empty slice
	assert.False(t, StringInSlice("one", []string{}))
}