diff --git a/imports/api/projects.test.js b/imports/api/projects.test.js index 0764fdf..f009d89 100644 --- a/imports/api/projects.test.js +++ b/imports/api/projects.test.js @@ -6,6 +6,7 @@ import { assert } from 'meteor/practicalmeteor:chai'; if(Meteor.server) { + // buena forma de simular un usuario ya logueado Meteor.user = function() { return { 'services': { @@ -43,7 +44,7 @@ if(Meteor.server) 'user' : 'Llamatest2' }); }); - + // buen test para verificar que agrega y encuentra un proyecto it('Should find a newly created project', function() { // const result = Projects.find({}); var project = { @@ -75,7 +76,7 @@ if(Meteor.server) }); // console.log(result) }); - + // buen test para verificar que el comentario se agregue it('Should comment a project', function() { const project = Projects.find({}).fetch(); // console.log(project[0]); @@ -86,7 +87,7 @@ if(Meteor.server) // console.log(projectModified[0]); }); }); - + // buen test para verificar la actualizacion del nuevo rating it('Should update mean rating of a project', function() { const project = Projects.find({}).fetch(); Meteor.call('projects.addRating', {projId:project[0]._id, newRate:5}, function() { @@ -159,3 +160,5 @@ if(Meteor.server) }); } + +// en general muy completos los tests diff --git a/imports/ui/proyecto/proyecto.test.jsx b/imports/ui/proyecto/proyecto.test.jsx index a9ff2fc..2190ef1 100644 --- a/imports/ui/proyecto/proyecto.test.jsx +++ b/imports/ui/proyecto/proyecto.test.jsx @@ -16,6 +16,7 @@ import {Meteor} from 'meteor/meteor'; if(Meteor.isClient) { + // muy bien esta solucion para simular que ya esta logueado el usuario Meteor.userId = function() { return '1213213'; }; @@ -36,6 +37,7 @@ if(Meteor.isClient) beforeEach(function () { console.log(Meteor.user()); + // este const user para que lo usan? const user = { 'services': { 'github': { @@ -48,6 +50,8 @@ if(Meteor.isClient) // console.log(Meteor.users.find({}).fetch()); }); + + // buen test para verificar que se haya renderizado el proyecto it('Should Render correctly', function () { const testProject = Factory.build('project', { 'url' : 'https://github.com/Llamatech/review-me', @@ -77,6 +81,9 @@ if(Meteor.isClient) chai.assert(result.hasClass('proyecto')); // chai.assert.equal(true, true, "Test"); }); + + // depronto hacer un test para verificar que proyModal se renderiza bien }); } +// los archivos tests estan a la mitad del proyecto, lo cual puede llegar a ser confuso. Depronto seria bueno dejarlos en una carpeta testing aparte \ No newline at end of file