tests (boilerplate)
This commit is contained in:
25
server/test/webserver_test.go
Normal file
25
server/test/webserver_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestWebserver(t *testing.T) {
|
||||
ws := NewSimpleWebserver(t)
|
||||
defer ws.Stop()
|
||||
go func() { ws.Run() }()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
func TestPing(t *testing.T) {
|
||||
ws := NewSimpleWebserver(t)
|
||||
defer ws.Stop()
|
||||
go func() { ws.Run() }()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
baseUrl := "http://127.0.0.1:" + ws.Port
|
||||
|
||||
_ = requestGet[struct{}](t, baseUrl, "/api/ping")
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user