import test from "ava"; import {Lecture} from "../../src/lib/Lecture-es5.js"; test("Lecture: constructor:", t=>{ const name = "Informatic", ects = 5, sws = 3; const informatic = new Lecture(name, ects, sws, ); t.is(informatic.name, name); t.is(informatic.sws, sws); t.is(informatic.ects, ects); }); test("Lecture: get Effort", t =>{ const computerScience = new Lecture("JavaScript", 5, 4); const effort = computerScience.effortPerWeek(15); t.is(effort, 7); const lectures = [ new Lecture("Informatik 1", 5, 4), new Lecture("Programmierung 1", 8, 5), new Lecture("JavaScript", 5, 4) ]; const effortOfWeek = lectures.reduce( (acc, l) => l.effortPerWeek(15) + acc, 0); const expected = 26.25; const tolerance = 0.01; t.truthy( Math.abs(effortOfWeek - expected) < tolerance ); });