all repos

onasty @ main

a one-time notes service

onasty/e2e/api_test.go(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package e2e_test

import "net/http"

type apiPingResponse struct {
	Message string `json:"message"`
}

func (e *AppTestSuite) TestPing() {
	httpResp := e.httpRequest(http.MethodGet, "/api/ping", nil)

	var body apiPingResponse
	e.readBodyAndUnjsonify(httpResp.Body, &body)

	e.Equal(http.StatusOK, httpResp.Code)
	e.Equal(body.Message, "pong")
}