Promise.all(semesters.map(function (semester) { return self.__getSemesterExams__(semester); } )).then(function (examsArray) { return _.chain(examsArray).flatten().uniq(function (exam) { return exam.course.id; }).value(); }, function (err) { return self.__getAllExamsOffline__(); })
describe('Get Natural', function() { var john1, john2; before(function(done){ Promise.all([api.Users.get(john.Id), api.Users.getNatural(john.Id)]).then(function(res){ john1 = res[0]; john2 = res[1]; done(); }) }); it('John should be the same', function(){ expect(_.isMatch(john1, _.omit(john.data, 'Address'))).to.be.true; expect(_.isMatch(john2, _.omit(john.data, 'Address'))).to.be.true; }); it('Fails for Legal User', function(done) { api.Users.getLegal(john.Id, function(data) { expect(data.errors).to.exist; done(); }); }); });
Promise.all(semesters.map(function (semester) { return self.__getSemesterCourses__(semester); } )).then(function (coursesArray) { return _.chain(coursesArray).flatten().uniq(function (course) { return course.id; }).value(); }, function (err) { return self.__getAllCoursesOffline__(); })
describe('Get Legal', function(){ var matrix1, matrix2; before(function(done){ Promise.all([api.Users.get(matrix.Id), api.Users.getLegal(matrix.Id)]).then(function(res){ matrix1 = res[0]; matrix2 = res[1]; done(); }) }); it('Matrix should be the same', function(){ expect(_.isMatch(matrix1, _.omit(matrix.data, 'HeadquartersAddress', 'LegalRepresentativeAddress'))).to.be.true; expect(_.isMatch(matrix2, _.omit(matrix.data, 'HeadquartersAddress', 'LegalRepresentativeAddress'))).to.be.true; }); it('Fails for Natural User', function(done) { api.Users.getNatural(matrix.Id, function(data) { expect(data.errors).to.exist; done(); }); }); });