Fixed tests and prepared for mocha

This commit is contained in:
Daniel
2020-03-03 09:08:11 +01:00
parent 531b6cbf69
commit ea01007716
7 changed files with 11 additions and 13 deletions

View File

@@ -5,9 +5,9 @@ module.exports = cds.service.impl (function(){
// ( Note: we explicitly specify the namespace to support embedded reuse )
const { Reviews, Likes } = this.entities ('sap.capire.reviews')
this.before (['CREATE','UPDATE','DELETE'], 'Reviews', req => {
if (!req.data.rating) req.data.rating = Math.round(Math.random()*4)+1
})
// this.before (['CREATE','UPDATE'], 'Reviews', req => {
// if (!req.data.rating) req.data.rating = Math.round(Math.random()*4)+1
// })
// Emit an event to inform subscribers about new avg ratings for reviewed subjects
// ( Note: req.on.succeeded ensures we only do that if there's no error )