Skip to content

Commit

Permalink
Name Validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tausifmuzaffar committed Jul 31, 2017
1 parent 059d73c commit d6f504d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/v1/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7559,6 +7559,7 @@ paths:
type: string
maxLength: 254
description: Name of the bot data
pattern: ^[0-9A-Za-z_\\-]{0,60}$
value:
type: string
maxLength: 254
Expand Down
17 changes: 17 additions & 0 deletions tests/api/v1/botData/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ describe(`api: POST ${path}`, () => {
})
.catch(done);
});

it('Fail, botData with invalid name', (done) => {
testBotData.name = '~!invalidName';
api.post(`${path}`)
.set('Authorization', token)
.send(testBotData)
.expect(constants.httpStatus.BAD_REQUEST)
.end((err, res) => {
if (err) {
done(err);
}

expect(res.body.errors[ZERO].type).to
.contain(tu.schemaValidationErrorName);
done();
});
});
});
});

0 comments on commit d6f504d

Please sign in to comment.