mirror of
https://github.com/simon987/task_tracker.git
synced 2025-04-19 10:16:41 +00:00
29 lines
382 B
Go
29 lines
382 B
Go
package test
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/simon987/task_tracker/api"
|
|
"io/ioutil"
|
|
"testing"
|
|
)
|
|
|
|
func TestIndex(t *testing.T) {
|
|
|
|
r := Get("/", nil)
|
|
|
|
body, _ := ioutil.ReadAll(r.Body)
|
|
var info api.Info
|
|
err := json.Unmarshal(body, &info)
|
|
|
|
if err != nil {
|
|
t.Error(err.Error())
|
|
}
|
|
|
|
if len(info.Name) <= 0 {
|
|
t.Error()
|
|
}
|
|
if len(info.Version) <= 0 {
|
|
t.Error()
|
|
}
|
|
}
|