Skip to content

Commit

Permalink
Mais mudanças
Browse files Browse the repository at this point in the history
  • Loading branch information
RatoX committed Dec 23, 2014
1 parent 07bec77 commit b8a1d3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions app/scripts/services/util/releated-posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ angular.module('cmsApp')
finished = (header === argsLength);
}

console.log(result);
var agroups = _.flatten(_.compact(result));

var agroups = _.flatten(result);

return _.countBy(agroups);
};
Expand Down
9 changes: 7 additions & 2 deletions test/spec/services/util/releated-posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ describe('Service: ReleatedPosts', function () {

})
);
it('should get the posts with more relevance to a set of tags', function(){
var tags = ['Manga','Banana','Cianureto'];
expect(ReleatedPosts.getPostsByTags(tags)).toEqual({'sete':1, 'dois':1, 'tres': 1});
});

it('should get the posts with more relevance to a set of tags', function(){
var tags = ['Banana','Maca'];
expect(ReleatedPosts.getPostsByTags(tags)).toEqual({'sete':2});
expect(ReleatedPosts.getPostsByTags(tags)).toEqual({'sete':1});
});

it('should get the posts with more relevance to a set of tags', function(){
var tags = ['Banana','Maca','Cianureto'];
expect(ReleatedPosts.getPostsByTags(tags)).toEqual({'sete':3,'tres':2});
expect(ReleatedPosts.getPostsByTags(tags)).toEqual({'sete':3,'tres':1});
});
});
});

0 comments on commit b8a1d3a

Please sign in to comment.