-
-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathmain_test.go
More file actions
33 lines (27 loc) · 775 Bytes
/
main_test.go
File metadata and controls
33 lines (27 loc) · 775 Bytes
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
package main
import (
"strings"
"testing"
"github.com/rudrankriyam/App-Store-Connect-CLI/cmd"
)
func TestVersionInfoString(t *testing.T) {
prevVersion, prevCommit, prevDate := version, commit, date
t.Cleanup(func() {
version = prevVersion
commit = prevCommit
date = prevDate
})
version = "v1.2.3"
commit = "abc123"
date = "2026-02-10T00:00:00Z"
got := versionInfoString()
if !strings.Contains(got, "v1.2.3") || !strings.Contains(got, "abc123") || !strings.Contains(got, "2026-02-10T00:00:00Z") {
t.Fatalf("unexpected version info string: %q", got)
}
}
func TestRunVersionFlagReturnsSuccess(t *testing.T) {
code := run([]string{"--version"})
if code != cmd.ExitSuccess {
t.Fatalf("expected exit success (%d), got %d", cmd.ExitSuccess, code)
}
}