Files
shields/services/github/github-deployments.spec.js
Patric Stout 453821c40e Add [GithubDeployments] badge (#4477) (#4478)
* Add GitHub Deployments badge (#4477)

* require a message

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2019-12-31 18:13:16 +00:00

70 lines
1.3 KiB
JavaScript

'use strict'
const { test, given } = require('sazerac')
const GithubDeployments = require('./github-deployments.service')
describe('GithubDeployments', function() {
test(GithubDeployments.render, () => {
given({
state: 'SUCCESS',
}).expect({
message: 'success',
color: 'brightgreen',
})
given({
state: 'ERROR',
}).expect({
message: 'error',
color: 'red',
})
given({
state: 'IN_PROGRESS',
}).expect({
message: 'in progress',
color: undefined,
})
})
test(GithubDeployments.prototype.transform, () => {
given({
data: {
repository: {
deployments: {
nodes: [],
},
},
},
}).expectError('Not Found: environment not found')
given({
data: {
repository: {
deployments: {
nodes: [
{
latestStatus: null,
},
],
},
},
},
}).expectError('Not Found: deployment has no status (yet)')
given({
data: {
repository: {
deployments: {
nodes: [
{
latestStatus: {
state: 'SUCCESS',
},
},
],
},
},
},
}).expect({
state: 'SUCCESS',
})
})
})