test: add missing file
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 1 Nov 2023 09:58:06 +0000 (10:58 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 1 Nov 2023 09:58:06 +0000 (10:58 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
tests/utils/ElectricUtils.test.ts [new file with mode: 0644]

diff --git a/tests/utils/ElectricUtils.test.ts b/tests/utils/ElectricUtils.test.ts
new file mode 100644 (file)
index 0000000..449967c
--- /dev/null
@@ -0,0 +1,29 @@
+import { describe, it } from 'node:test';
+
+import { expect } from 'expect';
+
+import { ACElectricUtils, DCElectricUtils } from '../../src/utils/ElectricUtils';
+
+await describe('ElectricUtils test suite', async () => {
+  await it('Verify DCElectricUtils.power()', () => {
+    expect(DCElectricUtils.power(230, 1)).toBe(230);
+  });
+  await it('Verify DCElectricUtils.amperage()', () => {
+    expect(DCElectricUtils.amperage(1, 230)).toBe(0);
+  });
+  await it('Verify ACElectricUtils.powerTotal()', () => {
+    expect(ACElectricUtils.powerTotal(3, 230, 1)).toBe(690);
+  });
+  await it('Verify ACElectricUtils.powerPerPhase()', () => {
+    expect(ACElectricUtils.powerPerPhase(230, 1)).toBe(230);
+  });
+  await it('Verify ACElectricUtils.amperageTotal()', () => {
+    expect(ACElectricUtils.amperageTotal(3, 1)).toBe(3);
+  });
+  await it('Verify ACElectricUtils.amperageTotalFromPower()', () => {
+    expect(ACElectricUtils.amperageTotalFromPower(690, 230)).toBe(3);
+  });
+  await it('Verify ACElectricUtils.amperagePerPhaseFromPower()', () => {
+    expect(ACElectricUtils.amperagePerPhaseFromPower(3, 690, 230)).toBe(1);
+  });
+});