test: restore config command host mock

This commit is contained in:
Tam Nhu Tran
2026-03-17 09:58:11 -04:00
parent dcc67477ec
commit a4c1031324
@@ -88,6 +88,17 @@ beforeEach(() => {
}));
mock.module('../../../src/commands/config-dashboard-host', () => ({
normalizeDashboardHost: (host: string | undefined) => {
if (!host) {
return undefined;
}
if (host.startsWith('[') && host.endsWith(']') && host.includes(':')) {
return host.slice(1, -1);
}
return host;
},
isLoopbackHost: (host: string) =>
['localhost', '127.0.0.1', '::1', '[::1]'].includes(host.trim().toLowerCase()),
isWildcardHost: (host: string) => ['0.0.0.0', '::', '[::]'].includes(host.trim().toLowerCase()),