Files
shields/services/crates/crates-version.spec.js
chris48s 13d75e0607 upgrade to prettier 2 (#5051)
* arrowParens: avoid
* remove trailingComma setting
2020-05-05 21:07:43 +01:00

20 lines
635 B
JavaScript

'use strict'
const { test, given } = require('sazerac')
const { expect } = require('chai')
const { InvalidResponse } = require('..')
const CratesVersion = require('./crates-version.service')
describe('CratesVersion', function () {
test(CratesVersion.prototype.transform, () => {
given({ version: { num: '1.0.0' } }).expect({ version: '1.0.0' })
given({ crate: { max_version: '1.1.0' } }).expect({ version: '1.1.0' })
})
it('throws InvalidResponse on error response', function () {
expect(() =>
CratesVersion.prototype.transform({ errors: [{ detail: 'idk how...' }] })
).to.throw(InvalidResponse)
})
})