Skip to content

Instantly share code, notes, and snippets.

@quii
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quii/154c22e27ce9239d67a3 to your computer and use it in GitHub Desktop.
Save quii/154c22e27ce9239d67a3 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
)
func Test_it_calls_the_services_and_concatenates_the_results(t *testing.T) {
helloAPI := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello")
}))
worldAPI := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "world")
}))
result := Stitcher(helloAPI.URL, worldAPI.URL)
expected := "Hello, world"
if result != expected {
t.Errorf("Stitcher failed, expected [%s], got [%s]", expected, result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment