Skip to content

Commit

Permalink
doplnene bonus ulohy, zmazanie riesenia z ulohy8 ;-)
Browse files Browse the repository at this point in the history
  • Loading branch information
ainthek committed Nov 11, 2019
1 parent abe33a4 commit 9a42936
Show file tree
Hide file tree
Showing 2 changed files with 728 additions and 11 deletions.
32 changes: 21 additions & 11 deletions 08-cvicenie/ulohy/test/01-array-extras.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("FP - array functions", function() {
//debug(JSON.stringify(students, null, 2));
debug(students);
assert(Array.isArray(students));
console.log(JSON.stringify(students))
});

it("02-students without git repo", () => {
Expand Down Expand Up @@ -77,15 +78,15 @@ describe("FP - array functions", function() {
let studentsWithPoints = students
.map(fixPoints)


assert.deepStrictEqual(
studentsWithPoints,
require("./data/restructure-points.json")
);

});


function totalPoints(student) {
// TODO: implementujte
}
Expand All @@ -111,7 +112,7 @@ describe("FP - array functions", function() {
let sumOfAll = students
.map(fixPoints)
.map(totalPoints)
//.????()
//.????()

debug(sumOfAll);
assert(sumOfAll === 924);
Expand All @@ -122,8 +123,7 @@ describe("FP - array functions", function() {
let uniqueProjects = students
.map(fixProjects)
.reduce((uniqueProjects, student, i, students) => {
student.projects.forEach(uniqueProjects.add, uniqueProjects);
return i !== students.length - 1 ? uniqueProjects : [...uniqueProjects];
// TODO: pozri prednasky
}, new Set())

assert.deepStrictEqual(
Expand All @@ -136,7 +136,7 @@ describe("FP - array functions", function() {
it("09-group by project", () => {
// ku kazdemu projektu najst zoznam studentov
// vysledok ma vyzerat tak ako v group-by-project.json

let groupedByProject = students
.map(fixProjects)
.reduce((uniqueProjects, student) => {
Expand All @@ -145,7 +145,7 @@ describe("FP - array functions", function() {
}, new Map())
// convert map entries to array
groupedByProject = [...groupedByProject];

//debug(JSON.stringify(groupedByProject, null, 2));
assert.deepStrictEqual(
groupedByProject,
Expand All @@ -160,14 +160,24 @@ describe("FP - array functions", function() {
// aby vysledok vysiel podla duplicate-projects.json
let duplicateProjects = students
.map(fixProjects)
//. TODO:
//.
//.
//
//. TODO:
//.
//.
//
debug(JSON.stringify(duplicateProjects, null, 2));
assert.deepStrictEqual(
duplicateProjects,
require("./data/duplicate-projects.json")
);
});

describe.skip("bonus", () => {
it("10b - top 3 projects", () => {


});
it("11 -always same team", () => {

});
})
});
Loading

0 comments on commit 9a42936

Please sign in to comment.