-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproblem_helpers_test.go
More file actions
34 lines (27 loc) · 865 Bytes
/
problem_helpers_test.go
File metadata and controls
34 lines (27 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package httpsuite
import (
"net/http"
"testing"
)
func TestProblemBuilderHelpers(t *testing.T) {
t.Parallel()
badRequest := ProblemBadRequest("invalid page").Build()
if badRequest.Status != http.StatusBadRequest {
t.Fatalf("expected bad request status, got %d", badRequest.Status)
}
notFound := ProblemNotFound("user missing").Build()
if notFound.Status != http.StatusNotFound {
t.Fatalf("expected not found status, got %d", notFound.Status)
}
}
func TestDirectProblemHelpers(t *testing.T) {
t.Parallel()
badRequest := NewBadRequestProblem("invalid payload")
if badRequest.Status != http.StatusBadRequest {
t.Fatalf("expected bad request status, got %d", badRequest.Status)
}
notFound := NewNotFoundProblem("user missing")
if notFound.Status != http.StatusNotFound {
t.Fatalf("expected not found status, got %d", notFound.Status)
}
}