test(ircserver): cover VERSION/ADMIN/TIME under the default empty SERVER_NAME
Some checks failed
check / check (push) Failing after 1m16s
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:
@@ -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",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user