mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 03:13:12 +00:00
test: restore config command host mock
This commit is contained in:
1 parent
dcc67477ec
commit
a4c1031324
1 file changed
+11
@@ -88,6 +88,17 @@ beforeEach(() => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
mock.module('../../../src/commands/config-dashboard-host', () => ({
|
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) =>
|
isLoopbackHost: (host: string) =>
|
||||||
['localhost', '127.0.0.1', '::1', '[::1]'].includes(host.trim().toLowerCase()),
|
['localhost', '127.0.0.1', '::1', '[::1]'].includes(host.trim().toLowerCase()),
|
||||||
isWildcardHost: (host: string) => ['0.0.0.0', '::', '[::]'].includes(host.trim().toLowerCase()),
|
isWildcardHost: (host: string) => ['0.0.0.0', '::', '[::]'].includes(host.trim().toLowerCase()),
|
||||||
|
|||||||
Reference in new issue
Block a user