-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain_test.go
More file actions
37 lines (30 loc) · 851 Bytes
/
Copy pathmain_test.go
File metadata and controls
37 lines (30 loc) · 851 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
34
35
36
37
package main
import (
"fmt"
"log"
"os"
"strings"
"testing"
"github.com/joho/godotenv"
)
func TestGetCode(t *testing.T) {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
githubPersonalAccessToken := os.Getenv("GITHUB_TOKEN")
if githubPersonalAccessToken == "" {
fmt.Println("Error: GITHUB_TOKEN environment variable not set")
return
}
repoURL := os.Getenv("REPO_URL")
branchPrefix := os.Getenv("BRANCH_PREFIX")
branchName, repo, _, err := GetCode(branchPrefix, repoURL, githubPersonalAccessToken)
branchNameDesiredPrefix := branchPrefix
if !strings.Contains(branchName, branchNameDesiredPrefix) {
t.Errorf("branch name %q does not have desired prefix %q", branchName, branchNameDesiredPrefix)
} else if 1 != 2 {
test, _ := repo.Storer.Config()
t.Errorf("got %q want %q", test, 2)
}
}