use the rejectedWith check in comments tests too

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-12-20 18:48:23 +01:00
parent a42f78b710
commit db52b7d776
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 4 additions and 8 deletions

View File

@ -56,11 +56,7 @@ describe('Comments', () => {
describe('renderComment', () => {
it('should fail with no builds', async () => {
builds.getBuilds.returns([])
try {
await comments.renderComment('PR-ID')
} catch(err) {
expect(err.message).to.eq('No builds exist for this PR')
}
expect(comments.renderComment('PR-ID')).rejectedWith('No builds exist for this PR')
})
it('should render correctly', async () => {

View File

@ -29,12 +29,12 @@ describe('Schema', () => {
it('can\'t be a null', () => {
build.commit = null
expect(Joi.validate(build, Schema)).to.be.rejectedWith('"commit" must be a string')
expect(Joi.validate(build, Schema)).rejectedWith('"commit" must be a string')
})
it('can\'t be a number', async () => {
build.commit = 1
expect(Joi.validate(build, Schema)).to.be.rejectedWith('"commit" must be a string')
expect(Joi.validate(build, Schema)).rejectedWith('"commit" must be a string')
})
})
@ -52,7 +52,7 @@ describe('Schema', () => {
it('can\'t be a number', async () => {
build.pkg_url = 1
expect(Joi.validate(build, Schema)).to.be.rejectedWith('"pkg_url" must be a string')
expect(Joi.validate(build, Schema)).rejectedWith('"pkg_url" must be a string')
})
})
})