-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmain_test.go
50 lines (48 loc) · 2.07 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
package main
import (
"reflect"
"testing"
)
func Test_buildIonicCommandArgs(t *testing.T) {
type args struct {
isAAB bool
options []string
}
tests := []struct {
name string
args args
want []string
}{
{name: "NoOptions & NoAAB", args: args{
isAAB: false,
options: nil,
}, want: []string{"cordova", "build", "--release", "--device", "android", "--buildConfig", "/foo/bar/baz/qux", "--", "--", "--packageType=apk"}},
{name: "NoOptions & AAB", args: args{
isAAB: true,
options: nil,
}, want: []string{"cordova", "build", "--release", "--device", "android", "--buildConfig", "/foo/bar/baz/qux", "--", "--", "--packageType=bundle"}},
{name: "SimpleOptions & AAB", args: args{
isAAB: true,
options: []string{"foo", "bar"},
}, want: []string{"cordova", "build", "--release", "--device", "android", "--buildConfig", "/foo/bar/baz/qux", "foo", "bar", "--", "--", "--packageType=bundle"}},
{name: "SimpleOptions & NoAAB", args: args{
isAAB: false,
options: []string{"foo", "bar"},
}, want: []string{"cordova", "build", "--release", "--device", "android", "--buildConfig", "/foo/bar/baz/qux", "foo", "bar", "--", "--", "--packageType=apk"}},
{name: "SimpleOptions + Platform & AAB", args: args{
isAAB: true,
options: []string{"foo", "bar", "--", "--", "--baz=qux"},
}, want: []string{"cordova", "build", "--release", "--device", "android", "--buildConfig", "/foo/bar/baz/qux", "foo", "bar", "--", "--", "--baz=qux", "--packageType=bundle"}},
{name: "ComplexOptions & AAB", args: args{
isAAB: true,
options: []string{"foo", "bar", "--", "baz", "--", "qux"},
}, want: []string{"cordova", "build", "--release", "--device", "android", "--buildConfig", "/foo/bar/baz/qux", "foo", "bar", "--", "baz", "--", "qux", "--packageType=bundle"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := buildIonicCommandArgs(3, "release", "device", "/foo/bar/baz/qux", "android", tt.args.isAAB, tt.args.options); !reflect.DeepEqual(got, tt.want) {
t.Errorf("buildIonicCommandArgs() = %v, want %v", got, tt.want)
}
})
}
}