import assert from 'assert'; import {calcWeight} from '../src/tools.js'; describe('calcWeight', () => { it('van ilyen függvény?', () => { assert(typeof calcWeight === 'function'); }); it('200, 200 bemenetre 673.570767028711', () => { const actual = calcWeight(200, 200); const expected = 673.570767028711; assert(actual === expected); }); it('180, 210 bemenetre 572.8719373579187', () => { const actual = calcWeight(180, 210); const expected = 572.8719373579187; assert(actual === expected); }) it('1, 210 bemenetre 0.017681232634503663', () => { const actual = calcWeight(1, 210); const expected = 0.017681232634503663; assert(actual === expected); }) it('0, 210 bemenetre 0', () => { assert.throws(() => { calcWeight(0, 210) }, Error); }) it('0, 210 bemenetre 0', () => { let error; try { calcWeight(0, 210) } catch (err) { error = err; } assert.ok(error); assert.equal(error.message, 'Érvénytelen paraméter'); }) });