-
Notifications
You must be signed in to change notification settings - Fork 0
/
bentekkie_mainframe_suite_test.go
77 lines (70 loc) · 1.66 KB
/
bentekkie_mainframe_suite_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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main_test
import (
"testing"
"time"
"github.com/bentekkie/bentekkie-mainframe/server/db"
"github.com/bentekkie/bentekkie-mainframe/server/env"
"github.com/joho/godotenv"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/ory/dockertest/v3"
"github.com/sclevine/agouti"
log "github.com/sirupsen/logrus"
)
var (
pool, _ = dockertest.NewPool("")
agoutiDriver *agouti.WebDriver
)
var (
user, _ = env.GetEnvStr("POSTGRES_USER")
password, _ = env.GetEnvStr("POSTGRES_PASSWORD")
dbName, _ = env.GetEnvStr("POSTGRES_DB")
testDB = db.JSONINode{
Name: "",
Folders: []db.JSONINode{
{
Name: "testFolder",
Files: []db.JSONFile{
{
Name: "testFile",
Contents: "Hello World!",
},
{
Name: "anotherFile",
Contents: "Another File",
},
},
Folders: []db.JSONINode{},
},
},
Files: []db.JSONFile{
{
Name: ".init",
Contents: "cat testFolder/testFile",
},
},
}
)
func TestBentekkieMainframe(t *testing.T) {
if err := godotenv.Load(); err != nil {
log.Print("No .env file found")
}
SetDefaultEventuallyTimeout(time.Second * 5)
RegisterFailHandler(Fail)
// startWebsite()
RunSpecs(t, "BentekkieMainframe Suite")
// websiteSession.Kill()
}
var _ = AfterSuite(func() {
if agoutiDriver != nil {
Expect(agoutiDriver.Stop()).To(Succeed())
}
})
var _ = SynchronizedBeforeSuite(func() []byte {
return []byte{}
}, func(bytes []byte) {
str := string(bytes)
Expect(str).To(BeEmpty())
agoutiDriver = agouti.ChromeDriver(agouti.ChromeOptions("args", []string{"--headless", "--disable-gpu", "--no-sandbox"}))
Expect(agoutiDriver.Start()).To(Succeed())
})