actual results when running tutorial code returns different results, not your expected results
mauricefaeh opened this issue · 0 comments
Hi, I'm working my way trough the quick guide tutorial on your website.
When running the following code example I get different results, not your expected results.
Code from tutorial:
`var seneca = require('seneca')()
seneca.add({role: 'math', cmd: 'sum'}, function (msg, respond) {
var sum = msg.left + msg.right
respond(null, {answer: sum})
})
// both these messages match role: math, cmd: sum
seneca.act({role: 'math', cmd: 'sum', left: 1.5, right: 2.5}, console.log)
seneca.act({role: 'math', cmd: 'sum', left: 1.5, right: 2.5, integer: true}, console.log)
seneca.add({role: 'math', cmd: 'sum', integer: true}, function (msg, respond) {
var sum = Math.floor(msg.left) + Math.floor(msg.right)
respond(null, { answer: sum })
})
// this still matches role: math, cmd: sum
seneca.act({role: 'math', cmd: 'sum', left: 1.5, right: 2.5}, console.log)
// BUT this matches role:math,cmd:sum,integer:true
// because it's more specific - more properties match
seneca.act({role: 'math', cmd: 'sum', left: 1.5, right: 2.5, integer: true}, console.log)`
Expected results:
2016 ... INFO hello ... null { answer: 4 } null { answer: 4 } null { answer: 4 } null { answer: 3 }
Actual results:
{ answer: 4 } { answer: 3 } { answer: 4 } { answer: 3 }
The second act call returns 3 instead of 4