Skip to content

Commit

Permalink
switch->if, TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
gfr10598 committed Jan 2, 2019
1 parent 73d2258 commit f49a079
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 4 additions & 6 deletions api/v2/api-v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ func TestDoRequest(t *testing.T) {
callCount := 0

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch {
case callCount < 3:
if callCount < 3 {
w.WriteHeader(http.StatusServiceUnavailable)
default:
} else {
fmt.Fprint(w, expectedJson)
}
callCount++
Expand Down Expand Up @@ -67,11 +66,10 @@ func TestDoRequest(t *testing.T) {
func TestSomeErrors(t *testing.T) {
callCount := 0
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch {
case callCount == 0:
if callCount == 0 {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprint(w, "body message")
default:
} else {
w.WriteHeader(http.StatusServiceUnavailable)
}
callCount++
Expand Down
3 changes: 3 additions & 0 deletions handler/handler_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package handler_test

// TODO 201901 - TestStatusServiceUnavailable()
// TODO 201901 - TestStatusInternalError()

import (
"bytes"
"errors"
Expand Down

0 comments on commit f49a079

Please sign in to comment.