"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const windows_adapter_1 = require("../../../src/adapters/windows-adapter");
const errors_1 = require("../../../src/types/errors");
describe('WindowsAdapter 内部行为', () => {
    it('在 WMI 数据缺失 Size 时应限制磁盘占用不为负值', async () => {
        const adapter = new windows_adapter_1.WindowsAdapter();
        const internal = adapter;
        let callCount = 0;
        internal.executePowerShell = async () => {
            callCount += 1;
            if (callCount === 1) {
                throw new errors_1.MonitorError('psdrive failed', errors_1.ErrorCode.COMMAND_FAILED, 'win32');
            }
            return [
                {
                    DeviceID: 'C:',
                    FileSystem: 'NTFS',
                    FreeSpace: '1024'
                }
            ];
        };
        const disks = await adapter.getDiskInfo();
        (0, chai_1.expect)(disks).to.have.lengthOf(1);
        (0, chai_1.expect)(disks[0].mountPoint).to.equal('C:');
        (0, chai_1.expect)(disks[0].used).to.equal(0);
        (0, chai_1.expect)(disks[0].available).to.equal(1024);
        (0, chai_1.expect)(disks[0].usagePercentage).to.equal(0);
    });
    it('在网络统计命令失败时应回退为空结果', async () => {
        const adapter = new windows_adapter_1.WindowsAdapter();
        const internal = adapter;
        internal.executePowerShell = async () => {
            throw new errors_1.MonitorError('stats failed', errors_1.ErrorCode.COMMAND_FAILED, 'win32');
        };
        const stats = await adapter.getNetworkStats();
        (0, chai_1.expect)(stats).to.deep.equal([]);
    });
});
//# sourceMappingURL=windows-adapter.test.js.map