Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix(logging): device.created is not a flow event
Browse files Browse the repository at this point in the history
#1507

r=vbudhram
  • Loading branch information
philbooth authored Oct 17, 2016
1 parent 16cf030 commit 82e579c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ var ACTIVITY_FLOW_EVENTS = Object.keys(ALWAYS_ACTIVITY_FLOW_EVENTS)
'account.keyfetch': true,
'account.login.sentUnblockCode': true,
'account.login.confirmedUnblockCode': true,
'account.signed': true,
'device.created': true
'account.signed': true
})

function unbuffer(object) {
Expand Down
32 changes: 32 additions & 0 deletions test/local/log_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,38 @@ test(
}
)

test(
'device.created is not treated as a flow event',
function (t) {
var request = {
gatherMetricsContext: metricsContext.gather,
headers: {
'user-agent': 'foo'
},
payload: {
metricsContext: {
flowId: 'bar'
}
}
}
return log.activityEvent('device.created', request, {
uid: 'baz'
}).then(function () {
t.equal(logger.info.callCount, 1, 'logger.info was called once')
t.equal(statsd.write.callCount, 1, 'statsd.write was called once')

t.equal(metricsContext.gather.callCount, 0, 'metricsContext.gather was not called')
t.equal(logger.debug.callCount, 0, 'logger.debug was not called')
t.equal(logger.error.callCount, 0, 'logger.error was not called')
t.equal(logger.critical.callCount, 0, 'logger.critical was not called')
t.equal(logger.warn.callCount, 0, 'logger.warn was not called')

logger.info.reset()
statsd.write.reset()
})
}
)

test(
'log.activityEvent with flow event and missing flowId',
function (t) {
Expand Down

0 comments on commit 82e579c

Please sign in to comment.