test: lock in HOST validation and bind-interface control (E00-S04-T04)
Extend the env-adapter suite to the issue's reworked acceptance criteria: - static assertions: the adapter resolves HOST via resolveHost (hostname/IP at the adapter boundary) and the server passes config.host to server.listen - deterministic boundary probe: valid HOST forms (IPv4/IPv6/hostname) pass, invalid HOST forms throw ConfigStartupError naming host - boot probes: HOST=127.0.0.1 binds loopback only (no answer on a non-loopback interface) with the startup log reflecting the actual bind; an invalid HOST exits non-zero naming the field without echoing the raw value - mutation probes: bypassing resolveHost or dropping config.host from server.listen both fail - config-startup-error: update the order-asserion mutation probe for the new server.listen(config.port, config.host, ...) signature
This commit is contained in:
@@ -291,8 +291,8 @@ test('moving the adapter call after the server binds fails the order assertion (
|
||||
const moved = src
|
||||
.replace('const config = loadConfigFromEnv();\n', '')
|
||||
.replace(
|
||||
'server.listen(config.port, () => {',
|
||||
'server.listen(config.port, () => {\n const config = loadConfigFromEnv();',
|
||||
'server.listen(config.port, config.host, () => {',
|
||||
'server.listen(config.port, config.host, () => {\n const config = loadConfigFromEnv();',
|
||||
);
|
||||
assert.notEqual(moved, src, 'the mutation must actually move the adapter call after the bind');
|
||||
assert.throws(() => assertServerStartupValidation(moved), /before the server binds/);
|
||||
|
||||
Reference in New Issue
Block a user