1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/pkg/piperutils/projectStructure_test.go
2020-02-23 16:54:50 +01:00

48 lines
1.3 KiB
Go

package piperutils
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestProjectWithOnlyMtaFile(t *testing.T) {
projectStructure := ProjectStructure{directory: "testdata/mta"}
resultMta := projectStructure.UsesMta()
assert.True(t, resultMta)
resultPom := projectStructure.UsesMaven()
assert.False(t, resultPom)
resultNpm := projectStructure.UsesNpm()
assert.False(t, resultNpm)
}
func TestProjectWithOnlyPomFile(t *testing.T) {
projectStructure := ProjectStructure{directory: "testdata/maven"}
resultMta := projectStructure.UsesMta()
assert.False(t, resultMta)
resultPom := projectStructure.UsesMaven()
assert.True(t, resultPom)
resultNpm := projectStructure.UsesNpm()
assert.False(t, resultNpm)
}
func TestProjectWithOnlyNpmFile(t *testing.T) {
projectStructure := ProjectStructure{directory: "testdata/npm"}
resultMta := projectStructure.UsesMta()
assert.False(t, resultMta)
resultPom := projectStructure.UsesMaven()
assert.False(t, resultPom)
resultNpm := projectStructure.UsesNpm()
assert.True(t, resultNpm)
}
func TestDirectryParameterIsEmptyAndNoProjectFilesAreInIt(t *testing.T) {
projectStructure := ProjectStructure{}
resultMta := projectStructure.UsesMta()
assert.False(t, resultMta)
resultPom := projectStructure.UsesMaven()
assert.False(t, resultPom)
resultNpm := projectStructure.UsesNpm()
assert.False(t, resultNpm)
}