Record last update time and user from project-history

This commit is contained in:
James Allen
2018-09-13 10:38:52 +01:00
parent 24c479e984
commit ab10336110
10 changed files with 78 additions and 28 deletions
@@ -16,12 +16,15 @@ describe 'ProjectUpdateHandler', ->
describe 'marking a project as recently updated', ->
it 'should send an update to mongo', (done)->
project_id = "project_id"
@handler.markAsUpdated project_id, (err)=>
args = @ProjectModel.update.args[0]
args[0]._id.should.equal project_id
date = args[1].lastUpdated+""
now = Date.now()+""
date.substring(0,5).should.equal now.substring(0,5)
user_id = "mock_user_id"
timestamp = Date.now()
@handler.markAsUpdated project_id, user_id, timestamp, (err)=>
@ProjectModel.update.calledWith({
_id: project_id,
}, {
lastUpdated: new Date(timestamp),
lastUpdatedBy: user_id
}).should.equal true
done()
describe "markAsOpened", ->