statping/handlers/services_test.go

41 lines
850 B
Go
Raw Normal View History

2019-01-15 01:28:00 +00:00
package handlers
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestServiceRoutes(t *testing.T) {
tests := []HTTPTest{
{
Name: "Services",
URL: "/services",
Method: "GET",
ExpectedStatus: 200,
ExpectedContains: []string{`<title>Statping | Services</title>`},
},
{
Name: "Services 2",
URL: "/service/2",
Method: "GET",
ExpectedStatus: 200,
ExpectedContains: []string{`<title>Statping Github Status</title>`},
2019-02-06 18:51:30 +00:00
}, {
Name: "chart.js index file",
URL: "/charts.js",
Method: "GET",
ExpectedStatus: 200,
},
}
2019-01-15 01:28:00 +00:00
for _, v := range tests {
t.Run(v.Name, func(t *testing.T) {
2019-02-04 18:52:41 +00:00
_, t, err := RunHTTPTest(v, t)
2019-01-15 01:28:00 +00:00
assert.Nil(t, err)
if err != nil {
t.FailNow()
}
})
}
}