From d40fe1021392da2c74bc6156ad2734071c615495 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 27 Nov 2020 17:26:39 -0700 Subject: rewrite CoP post to use new examples --- assets/component-oriented-design/v1/main_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'assets/component-oriented-design/v1') diff --git a/assets/component-oriented-design/v1/main_test.go b/assets/component-oriented-design/v1/main_test.go index 6976690..6cfd9fb 100644 --- a/assets/component-oriented-design/v1/main_test.go +++ b/assets/component-oriented-design/v1/main_test.go @@ -114,7 +114,7 @@ func TestScoreboard(t *testing.T) { } //////////////////////////////////////////////////////////////////////////////// -// Test httpHandler component +// Test httpHandlers component type mockScoreboard map[string]int @@ -155,3 +155,13 @@ func TestHTTPHandlers(t *testing.T) { r = httptest.NewRequest("GET", "/scores", nil) assertRequest(t, 200, "bar: 2\nfoo: 1\n", r) } + +//////////////////////////////////////////////////////////////////////////////// +// +// httpServer is NOT tested, for the following reasons: +// * It depends on a `net.Listener`, which is not trivial to mock. +// * It does very little besides passing an httpHandlers along to an http.Server +// and managing cleanup. +// * It isn't likely to be changed often. +// * If it were to break it would be very apparent in subsequent testing stages. +// -- cgit v1.2.3