UNPKG

node-os-utils

Version:

Advanced cross-platform operating system monitoring utilities with TypeScript support

22 lines 953 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const network_monitor_1 = require("../../../src/monitors/network-monitor"); describe('NetworkMonitor 网关与接口转换', () => { const monitor = new network_monitor_1.NetworkMonitor({}); it('应保留无显式网关但存在接口的默认路由', () => { const result = monitor.transformGatewayInfo({ gateway: null, interface: 'ppp0' }); (0, chai_1.expect)(result).to.deep.equal({ gateway: null, interface: 'ppp0' }); }); it('应兼容 iface/device 字段并返回可用接口名', () => { const result = monitor.transformGatewayInfo({ iface: 'eth0', address: '192.168.0.1' }); (0, chai_1.expect)(result).to.deep.equal({ gateway: '192.168.0.1', interface: 'eth0' }); }); }); //# sourceMappingURL=network-monitor.test.js.map