package utils

import (
	"testing"

	. "github.com/onsi/gomega"
)

func TestIsIncludeString(t *testing.T) {
	g := NewGomegaWithT(t)
	g.Expect(IsIncludeString([]string{"1", "2", "3"}, "3")).Should(BeTrue())
	g.Expect(IsIncludeString([]string{"1", "2", "3"}, "4")).ShouldNot(BeTrue())
}

func TestConvertDurationString(t *testing.T) {
	testCases := []struct {
		durationString string
		expectedResult string
	}{
		{"10m0s", "10m"},
		{"1h30m0s", "90m"},
		{"45s", "0m"},
		{"", ""},
	}

	for _, tc := range testCases {
		actualResult := ConvertDurationString(tc.durationString)
		if actualResult != tc.expectedResult {
			t.Errorf("unexpected result, expected %s but got %s", tc.expectedResult, actualResult)
		}
	}
}
