-
Notifications
You must be signed in to change notification settings - Fork 6
/
main_test.go
57 lines (44 loc) · 1.69 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"strings"
"testing"
"github.com/bitrise-io/go-xcode/utility"
"github.com/bitrise-io/go-xcode/v2/xcarchive"
"github.com/stretchr/testify/assert"
)
func TestConfig_generateExportOptions_plist(t *testing.T) {
// Given
xcodebuildVersion, _ := utility.GetXcodeVersion()
archive, _ := xcarchive.NewIosArchive("configs.ArchivePath")
// When
result, _ := generateExportOptionsPlist("app", "development", "my team id", false, false, xcodebuildVersion.MajorVersion, archive, false)
// Then
if len(result) == 0 {
t.Errorf("plist is empty")
}
assert.NotEqual(t, 0, len(result))
}
func TestConfig_generateExportOptions_plist_validField(t *testing.T) {
// Given
xcodebuildVersion, _ := utility.GetXcodeVersion()
archive, _ := xcarchive.NewIosArchive("configs.ArchivePath")
// When
result, err := generateExportOptionsPlist("app", "development", "my team id", false, false, xcodebuildVersion.MajorVersion, archive, true)
// Then
assert.Nil(t, err)
assert.Contains(t, result, "compileBitcode")
assert.Contains(t, result, "method")
assert.Contains(t, result, "development")
}
func TestConfig_generateExportOptions_plist_updateVersionAndBuildSetToFalse(t *testing.T) {
// Given
xcodebuildVersion, _ := utility.GetXcodeVersion()
archive, _ := xcarchive.NewIosArchive("configs.ArchivePath")
// When
result, err := generateExportOptionsPlist("app", "app-store", "my team id", false, false, xcodebuildVersion.MajorVersion, archive, false)
// Then
assert.Nil(t, err)
if xcodebuildVersion.MajorVersion > 12 && strings.Contains(result, "manageAppVersionAndBuildNumber") == false {
t.Errorf("plist does not contain manage app version and build number value for method field")
}
}