Rename hook for clarity

This commit is contained in:
Alasdair Smith 2017-11-15 16:28:41 +00:00
parent 119be26989
commit 24ceaffd3a
2 changed files with 4 additions and 4 deletions

View file

@ -150,7 +150,7 @@ module.exports = ProjectController =
projects: (cb)->
ProjectGetter.findAllUsersProjects user_id, 'name lastUpdated publicAccesLevel archived owner_ref tokens', cb
v1Projects: (cb) ->
Modules.hooks.fire "findAllUsersProjects", user_id, (error, projects = []) ->
Modules.hooks.fire "findAllV1Projects", user_id, (error, projects = []) ->
cb error, projects[0] # hooks.fire returns an array of results, only need first
hasSubscription: (cb)->
LimitationsManager.userHasSubscriptionOrIsGroupMember currentUser, cb

View file

@ -267,7 +267,7 @@ describe "ProjectController", ->
@TagsHandler.getAllTags.callsArgWith(1, null, @tags, {})
@NotificationsHandler.getUserNotifications = sinon.stub().callsArgWith(1, null, @notifications, {})
@ProjectGetter.findAllUsersProjects.callsArgWith(2, null, @allProjects)
@Modules.hooks.fire.yields(undefined) # Without integration module hook, cb returns undefined
@Modules.hooks.fire.withArgs('findAllV1Projects', @user._id).yields(undefined) # Without integration module hook, cb returns undefined
it "should render the project/list page", (done)->
@res.render = (pageName, opts)=>
@ -310,7 +310,7 @@ describe "ProjectController", ->
tags: [
{ name: 'mock tag', project_ids: ['123mockV1Id'] }
]
@Modules.hooks.fire.withArgs('findAllUsersProjects', @user._id).yields(null, [@V1Response]) # Need to wrap response in array, as multiple hooks could fire
@Modules.hooks.fire.withArgs('findAllV1Projects', @user._id).yields(null, [@V1Response]) # Need to wrap response in array, as multiple hooks could fire
it 'should include V1 projects', (done) ->
@res.render = (pageName, opts) =>
@ -390,7 +390,7 @@ describe "ProjectController", ->
@TagsHandler.getAllTags.callsArgWith(1, null, @tags, {})
@NotificationsHandler.getUserNotifications = sinon.stub().callsArgWith(1, null, @notifications, {})
@ProjectGetter.findAllUsersProjects.callsArgWith(2, null, @allProjects)
@Modules.hooks.fire.withArgs('findAllUsersProjects', @user._id).yields(undefined) # Without integration module hook, cb returns undefined
@Modules.hooks.fire.withArgs('findAllV1Projects', @user._id).yields(undefined) # Without integration module hook, cb returns undefined
it "should render the project/list page", (done)->
@res.render = (pageName, opts)=>