updated hws.ThrowError to not return an error and log it to console instead

fixed errors_test

fixed tests
This commit is contained in:
2026-02-03 18:11:17 +11:00
parent 95a17597cf
commit 563908bbb4
14 changed files with 249 additions and 239 deletions

View File

@@ -18,7 +18,7 @@ func Test_AddRoutes(t *testing.T) {
server := createTestServer(t, &buf)
err := server.AddRoutes()
assert.Error(t, err)
assert.Contains(t, err.Error(), "No routes provided")
assert.Contains(t, err.Error(), "no routes provided")
})
t.Run("Single valid route", func(t *testing.T) {
@@ -58,7 +58,7 @@ func Test_AddRoutes(t *testing.T) {
Handler: handler,
})
assert.Error(t, err)
assert.Contains(t, err.Error(), "Invalid method")
assert.Contains(t, err.Error(), "invalid method")
})
t.Run("No handler provided", func(t *testing.T) {
@@ -69,7 +69,7 @@ func Test_AddRoutes(t *testing.T) {
Handler: nil,
})
assert.Error(t, err)
assert.Contains(t, err.Error(), "No handler provided")
assert.Contains(t, err.Error(), "no handler provided")
})
t.Run("All HTTP methods are valid", func(t *testing.T) {
@@ -203,7 +203,7 @@ func Test_AddRoutes_MultipleMethods(t *testing.T) {
Handler: handler,
})
assert.Error(t, err)
assert.Contains(t, err.Error(), "Invalid method")
assert.Contains(t, err.Error(), "invalid method")
})
t.Run("Empty Methods slice falls back to Method field", func(t *testing.T) {