Skip to content

Commit

Permalink
feat: updated coverity services
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcartwright committed Dec 18, 2018
1 parent 56f7840 commit 06992fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
1 change: 0 additions & 1 deletion services/coverity/coverity-scan.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ module.exports = class CoverityScan extends BaseJsonService {
staticPreview: this.render({
message: 'passed',
}),
keywords: ['coverity', 'scan'],
},
]
}
Expand Down
33 changes: 25 additions & 8 deletions services/coverity/coverity-scan.tester.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const Joi = require('joi')
const { colorScheme } = require('../test-helpers')
const t = (module.exports = require('../create-service-tester')())

t.create('live: known project id')
Expand All @@ -27,45 +28,61 @@ t.create('404 response')
.expectJSON({ name: 'coverity', value: 'project not found' })

t.create('passed')
.get('/2.json')
.get('/2.json?style=_shields_test')
.intercept(nock =>
nock('https://scan.coverity.com/projects/2')
.get('/badge.json')
.reply(200, {
message: 'passed',
})
)
.expectJSON({ name: 'coverity', value: 'passing' })
.expectJSON({
name: 'coverity',
value: 'passing',
colorB: colorScheme.brightgreen,
})

t.create('passed with defects')
.get('/2.json')
.get('/2.json?style=_shields_test')
.intercept(nock =>
nock('https://scan.coverity.com/projects/2')
.get('/badge.json')
.reply(200, {
message: 'passed 51 new defects',
})
)
.expectJSON({ name: 'coverity', value: 'passed 51 new defects' })
.expectJSON({
name: 'coverity',
value: 'passed 51 new defects',
colorB: colorScheme.yellow,
})

t.create('pending')
.get('/2.json')
.get('/2.json?style=_shields_test')
.intercept(nock =>
nock('https://scan.coverity.com/projects/2')
.get('/badge.json')
.reply(200, {
message: 'pending',
})
)
.expectJSON({ name: 'coverity', value: 'pending' })
.expectJSON({
name: 'coverity',
value: 'pending',
colorB: colorScheme.orange,
})

t.create('failed')
.get('/2.json')
.get('/2.json?style=_shields_test')
.intercept(nock =>
nock('https://scan.coverity.com/projects/2')
.get('/badge.json')
.reply(200, {
message: 'failed',
})
)
.expectJSON({ name: 'coverity', value: 'failed' })
.expectJSON({
name: 'coverity',
value: 'failed',
colorB: colorScheme.red,
})

0 comments on commit 06992fd

Please sign in to comment.