-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcreate_test.go
More file actions
49 lines (46 loc) · 1.11 KB
/
create_test.go
File metadata and controls
49 lines (46 loc) · 1.11 KB
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
package projectfile
import (
"path/filepath"
"testing"
"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/fileutils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_Create(t *testing.T) {
tempDir := fileutils.TempDirUnsafe()
type args struct {
org string
project string
directory string
language string
}
tests := []struct {
name string
args args
want error
wantContents string
}{
{
"orgName/projName",
args{"orgName", "projName", tempDir, "python3"},
nil,
"orgName/projName?branch=main",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := Create(&CreateParams{
Owner: tt.args.org,
Project: tt.args.project,
Directory: tt.args.directory,
Language: tt.args.language,
Host: "test.example.com",
})
assert.NoError(t, err)
configFile := filepath.Join(tempDir, constants.ConfigFileName)
require.FileExists(t, configFile)
assert.Contains(t, string(fileutils.ReadFileUnsafe(configFile)), tt.wantContents)
})
}
}