The first thing we will do is break the dependence on the upstream currency service in the test. Then, we will proceed to add tests to cover additional scenarios that we couldn't cover before. This is what our test currently looks like:
func TestRegisterHandler_ServeHTTP(t *testing.T) { // ensure the test always fails by giving it a timeout ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() // Create and start a server // With out current implementation, we cannot test this handler without // a full server as we need the mux. address, err := startServer(ctx) require.NoError(t, err) // build inputs validRequest := buildValidRequest() response, err := http.Post("http://"