1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-07 13:42:23 +02:00
sap-jenkins-library/pkg/gcs/targetFolderHandler_test.go
Jk1484 ffc931aad1
feat(golangBuild): use 'unit' build tag to include tests during test execution (#4345)
* Added unit tag as argument. Added description to runTests command. Changed code generator to have unit build tag in generated unit test files.

* Added unit build tag to all unit test files.

* added to new unit test unit build tag

* Update verify-go.yml

* small fix

---------

Co-authored-by: Muhammadali Nazarov <Muhammadali.Nazarov@acronis.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2023-05-03 21:02:11 +05:00

32 lines
972 B
Go

//go:build unit
// +build unit
package gcs
import (
"fmt"
"testing"
)
func TestGetTargetFolder(t *testing.T) {
tests := []struct {
folderPath string
stepResultType string
subFolder string
expected string
}{
{folderPath: "folder/path/", stepResultType: "general", subFolder: "sub/folder", expected: "folder/path/general/sub/folder"},
{folderPath: "folder/path/", subFolder: "sub/folder", expected: "folder/path/sub/folder"},
{folderPath: "folder/path/", stepResultType: "general", expected: "folder/path/general"},
{folderPath: "folder1", stepResultType: "general", subFolder: "folder2/", expected: "folder1/general/folder2"}}
for key, tt := range tests {
t.Run(fmt.Sprintf("Row %v", key+1), func(t *testing.T) {
actualTargetFolder := GetTargetFolder(tt.folderPath, tt.stepResultType, tt.subFolder)
if actualTargetFolder != tt.expected {
t.Errorf("Expected '%v' was '%v'", tt.expected, actualTargetFolder)
}
})
}
}