Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions imports/api/projects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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]);
Expand All @@ -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() {
Expand Down Expand Up @@ -159,3 +160,5 @@ if(Meteor.server)

});
}

// en general muy completos los tests
7 changes: 7 additions & 0 deletions imports/ui/proyecto/proyecto.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
};
Expand All @@ -36,6 +37,7 @@ if(Meteor.isClient)

beforeEach(function () {
console.log(Meteor.user());
// este const user para que lo usan?
const user = {
'services': {
'github': {
Expand All @@ -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',
Expand Down Expand Up @@ -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