hermez-node/api/noroute_test.go
api/noroute_test.goRaw
1package api
2
3import (
4 "testing"
5
6 "github.com/stretchr/testify/assert"
7)
8
9func TestNoRouteVersionNotProvided(t *testing.T) {
10 endpoint := apiIP + apiPort + "/"
11 // not using doGoodReq, bcs internally
12 // there is a method FindRoute that checks route and returns error
13 resp, err := doSimpleReq("GET", endpoint)
14 assert.NoError(t, err)
15 assert.Equal(t,
16 "{\"error\":\"Version not provided, please provide a valid version in the path such as v1\"}\n",
17 resp)
18}
19
20func TestNoRoute(t *testing.T) {
21 endpoint := apiURL
22 // not using doGoodReq, bcs internally
23 // there is a method FindRoute that checks route and returns error
24 resp, err := doSimpleReq("GET", endpoint)
25 assert.NoError(t, err)
26 assert.Equal(t,
27 "{\"error\":\"404 page not found\"}\n",
28 resp)
29}