add an extra test for invalid element names

This commit is contained in:
Brian Gough 2018-02-09 15:13:58 +00:00
parent 2c2b6e5f36
commit ecea3dd1be

View file

@ -1399,6 +1399,15 @@ describe 'ProjectEntityHandler', ->
@ProjectModel.findOneAndUpdate.called.should.equal false @ProjectModel.findOneAndUpdate.called.should.equal false
done() done()
it "should error if element name contains invalid characters", (done)->
doc =
_id: ObjectId()
name: "something*bad"
@ProjectEntityHandler._putElement @project, @folder._id, doc, "doc", (err)=>
@ProjectModel.findOneAndUpdate.called.should.equal false
err.should.deep.equal new Errors.InvalidNameError("invalid element name")
done()
it "should error if element name is too long", (done)-> it "should error if element name is too long", (done)->
doc = doc =
_id: ObjectId() _id: ObjectId()