"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const power_calculation_js_1 = require("../src/domain/calculations/power-calculation.js"); (0, vitest_1.describe)("power calculation", () => { (0, vitest_1.it)("calculates installed power", () => { const result = (0, power_calculation_js_1.calculateInstalledPowerKw)({ quantity: 4, installedPowerPerUnitKw: 1.2, demandFactor: 0.8, }); (0, vitest_1.expect)(result).toBeCloseTo(4.8); }); (0, vitest_1.it)("calculates demand power", () => { const result = (0, power_calculation_js_1.calculateDemandPowerKw)({ quantity: 4, installedPowerPerUnitKw: 1.2, demandFactor: 0.8, }); (0, vitest_1.expect)(result).toBeCloseTo(3.84); }); (0, vitest_1.it)("handles zero quantity", () => { const result = (0, power_calculation_js_1.calculateInstalledPowerKw)({ quantity: 0, installedPowerPerUnitKw: 3, demandFactor: 0.9, }); (0, vitest_1.expect)(result).toBe(0); }); (0, vitest_1.it)("handles zero demand factor", () => { const result = (0, power_calculation_js_1.calculateDemandPowerKw)({ quantity: 5, installedPowerPerUnitKw: 2, demandFactor: 0, }); (0, vitest_1.expect)(result).toBe(0); }); (0, vitest_1.it)("calculates single-phase current", () => { const current = (0, power_calculation_js_1.calculateCurrentA)({ demandPowerKw: 2.3, voltageV: 230, phaseCount: 1, powerFactor: 0.95, }); (0, vitest_1.expect)(current).toBeCloseTo(10.53, 2); }); (0, vitest_1.it)("calculates three-phase current", () => { const current = (0, power_calculation_js_1.calculateCurrentA)({ demandPowerKw: 9.5, voltageV: 400, phaseCount: 3, powerFactor: 0.9, }); (0, vitest_1.expect)(current).toBeCloseTo(15.23, 2); }); });