-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_test.go
More file actions
37 lines (33 loc) · 772 Bytes
/
app_test.go
File metadata and controls
37 lines (33 loc) · 772 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 xecho_test
import (
"net/http"
"testing"
"github.com/JSainsburyPLC/xecho"
"github.com/steinfletcher/apitest"
)
func TestHealthCheck(t *testing.T) {
apitest.New().
Handler(xecho.Echo(config(""))).
Get("/health").
Expect(t).
Status(http.StatusOK).
Body(`{"status": "ok"}`).
End()
apitest.New().
Handler(xecho.New(config("test")).Echo).
Get("/test/health").
Expect(t).
Status(http.StatusOK).
Body(`{"status": "ok"}`).
End()
}
func config(routePrefix string) xecho.Config {
config := xecho.NewConfig()
config.RoutePrefix = routePrefix
config.ProjectName = "acme"
config.AppName = "login"
config.EnvName = "dev"
config.NewRelicLicense = "1111111111111111111111111111111111111111"
config.NewRelicEnabled = false
return config
}