test(ircserver): cover VERSION/ADMIN/TIME under the default empty SERVER_NAME
Some checks failed
check / check (push) Failing after 1m16s

Both wire test environments hardcoded ServerName: "test.irc", so no test
exercised the shipped default and the empty server-name parameter went
unnoticed for five rework rounds. Parameterize the env's server name and
add a wire test that runs with it empty, asserting the numerics name
"neoirc" and contain no empty parameter. Verified to fail against the
pre-fix handlers.
This commit is contained in:
user
2026-09-04 05:34:33 +00:00
parent cfff726054
commit 209b0ff364
2 changed files with 92 additions and 1 deletions

View File

@@ -38,6 +38,20 @@ type testEnv struct {
func newTestEnv(t *testing.T) *testEnv {
t.Helper()
return newTestEnvWithServerName(t, "test.irc")
}
// newTestEnvWithServerName creates a test environment with
// an explicit SERVER_NAME. Passing "" exercises the shipped
// default from config.go, under which the server must fall
// back to "neoirc" rather than emitting an empty
// server-name parameter.
func newTestEnvWithServerName(
t *testing.T,
serverName string,
) *testEnv {
t.Helper()
dsn := fmt.Sprintf(
"file:%s?mode=memory&cache=shared&_journal_mode=WAL",
t.Name(),
@@ -67,7 +81,7 @@ func newTestEnv(t *testing.T) *testEnv {
brk := broker.New()
cfg := &config.Config{ //nolint:exhaustruct
ServerName: "test.irc",
ServerName: serverName,
MOTD: "Welcome to test IRC",
}