// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

package shortcuts

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

// Test_systemType tests the systemType function
func Test_systemType(t *testing.T) {
	// Define possible system types
	var versions = []string{
		"Community", "Professional", "Home",
		"Server", "Personal", "Desktop",
		"",
	}

	// Verify systemType returns one of the expected values
	assert.Contains(t, versions, systemType())
}

// Test_arr2set tests the arr2set function
func Test_arr2set(t *testing.T) {
	// Test cases for array to set conversion
	testData := []struct {
		input  []string
		output map[string]bool
	}{
		{
			input: []string{"key1", "key2", "key3"},
			output: map[string]bool{
				"key1": true,
				"key2": true,
				"key3": true,
			},
		},
	}

	// Run each test case
	for _, data := range testData {
		assert.Equal(t, data.output, arr2set(data.input))
	}

}

// Test_strvLower tests the strvLower function
func Test_strvLower(t *testing.T) {
	// Test cases for string slice to lowercase conversion
	testData := []struct {
		in  []string
		out []string
	}{
		{
			in:  []string{"What's", "Your", "Problem"},
			out: []string{"what's", "your", "problem"},
		},
	}

	// Run each test case
	for _, data := range testData {
		assert.Equal(t, data.out, strvLower(data.in))
	}
}
