* Added GithubRPackageVersion badge * Minor changes to GithubGoModGoVersion badge * More examples * Removed mocking with nock from service tests * Added unit tests Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
31 lines
893 B
JavaScript
31 lines
893 B
JavaScript
'use strict'
|
|
|
|
const { expect } = require('chai')
|
|
const { test, given } = require('sazerac')
|
|
const { InvalidResponse } = require('..')
|
|
const GithubRPackageVersion = require('./github-r-package.service')
|
|
|
|
describe('GithubRPackageVersion', function () {
|
|
const content = versionLine =>
|
|
[
|
|
'Package: mypackage',
|
|
'Title: What The Package Does (one line, title case required)',
|
|
versionLine,
|
|
'',
|
|
].join('\n')
|
|
|
|
test(GithubRPackageVersion.transform, () => {
|
|
given(content('Version: 6.10.9'), 'DESCRIPTION').expect({
|
|
version: '6.10.9',
|
|
})
|
|
})
|
|
|
|
it('throws InvalidResponse if a file does not contain version specification', function () {
|
|
expect(() =>
|
|
GithubRPackageVersion.transform(content('Versio: 6.10.9'), 'DESCRIPTION')
|
|
)
|
|
.to.throw(InvalidResponse)
|
|
.with.property('prettyMessage', 'Version missing in DESCRIPTION')
|
|
})
|
|
})
|