fix bug in call to findAllUsersProjects

This commit is contained in:
Brian Gough 2018-10-12 12:10:35 +01:00
parent 1256d29af9
commit 59cf0aa3cb
2 changed files with 6 additions and 6 deletions

View file

@ -82,7 +82,7 @@ module.exports = ProjectDetailsHandler =
return callback(error) if error?
# allUsersProjectNames is returned as a hash {owned: [name1, name2, ...], readOnly: [....]}
# collect all of the names and flatten them into a single array
projectNameList = _.flatten(_.values(allUsersProjectNames))
projectNameList = _.pluck(_.flatten(_.values(allUsersProjectNames)),'name')
# create a set of all project names
allProjectNames = new Set()
for projectName in projectNameList

View file

@ -158,11 +158,11 @@ describe 'ProjectDetailsHandler', ->
describe "ensureProjectNameIsUnique", ->
beforeEach ->
@result = {
owned: ["name", "name1", "name11"]
readAndWrite: ["name2", "name22"]
readOnly: ["name3", "name33"]
tokenReadAndWrite: ["name4", "name44"]
tokenReadOnly: ["name5", "name55", "x".repeat(15)]
owned: [{_id: 1, name:"name"}, {_id: 2, name: "name1"}, {_id: 3, name: "name11"}]
readAndWrite: [{_id: 4, name:"name2"}, {_id: 5, name:"name22"}]
readOnly: [{_id:6, name:"name3"}, {_id:7, name: "name33"}]
tokenReadAndWrite: [{_id:8, name:"name4"}, {_id:9, name:"name44"}]
tokenReadOnly: [{_id:10, name:"name5"}, {_id:11, name:"name55"}, {_id:12, name:"x".repeat(15)}]
}
@ProjectGetter.findAllUsersProjects = sinon.stub().callsArgWith(2, null, @result)