Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
Apply minor adjustments to the code and tests in order to provide
maximum code coverage with unit tests.
  • Loading branch information
Icikowski committed Jun 15, 2022
1 parent 24f084f commit 247bd34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 1 addition & 3 deletions application/service/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ func PrepareServer(log zerolog.Logger, port int) *http.Server {
r.NotFoundHandler = getDefaultHandler(log)

log.Debug().Msg("registering shutdown hooks")
server.RegisterOnShutdown(func() {
health.ServiceStatus.MarkAsDown()
})
server.RegisterOnShutdown(health.ServiceStatus.MarkAsDown)

log.Info().Msg("server prepared")
return server
Expand Down
6 changes: 6 additions & 0 deletions application/service/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func TestPrepareServer(t *testing.T) {
expectedStatus: http.StatusOK,
expectedKeys: &[]string{"host", "path", "method", "headers", "queries"},
},
"get default endpoint with some queries": {
method: http.MethodGet,
path: "/?hello=world",
expectedStatus: http.StatusOK,
expectedKeys: &[]string{"host", "path", "method", "headers", "queries"},
},
"get default endpoint on other path": {
method: http.MethodGet,
path: "/a/b/c",
Expand Down

0 comments on commit 247bd34

Please sign in to comment.