mirror of
https://github.com/badges/shields.git
synced 2025-04-18 19:44:04 +03:00
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * reformat all the things (prettier 3) * update tests to await calls to prettier.format() --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: chris48s <git@chris-shaw.dev>
132 lines
3.3 KiB
JavaScript
132 lines
3.3 KiB
JavaScript
import { expect } from 'chai'
|
|
import { getDependencyVersion } from './pipenv-helpers.js'
|
|
import { InvalidParameter } from './index.js'
|
|
|
|
describe('getDependencyVersion', function () {
|
|
// loosely based on https://github.com/pypa/pipfile#pipfilelock
|
|
const packages = {
|
|
chardet: {
|
|
hashes: [
|
|
'sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691',
|
|
'sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae',
|
|
],
|
|
version: '==3.0.4',
|
|
},
|
|
django: {
|
|
editable: true,
|
|
git: 'https://github.com/django/django.git',
|
|
ref: '1.11.4001',
|
|
},
|
|
'django-cms': {
|
|
file: 'https://github.com/divio/django-cms/archive/release/3.4.x.zip',
|
|
},
|
|
'discordlists-py': {
|
|
git: 'https://github.com/HexCodeFFF/discordlists.py',
|
|
ref: '2df5a2b62144b49774728efa8267d909a8a9787f',
|
|
},
|
|
}
|
|
|
|
it('throws if dependency not found in (in default object with data)', function () {
|
|
expect(() =>
|
|
getDependencyVersion({
|
|
wantedDependency: 'requests',
|
|
lockfileData: {
|
|
default: packages,
|
|
develop: {},
|
|
},
|
|
}),
|
|
)
|
|
.to.throw(InvalidParameter)
|
|
.with.property('prettyMessage', 'default dependency not found')
|
|
})
|
|
|
|
it('throws if dependency not found in (in empty dev object)', function () {
|
|
expect(() =>
|
|
getDependencyVersion({
|
|
kind: 'dev',
|
|
wantedDependency: 'requests',
|
|
lockfileData: {
|
|
default: packages,
|
|
develop: {},
|
|
},
|
|
}),
|
|
)
|
|
.to.throw(InvalidParameter)
|
|
.with.property('prettyMessage', 'dev dependency not found')
|
|
})
|
|
|
|
it('tolerates missing keys', function () {
|
|
expect(
|
|
getDependencyVersion({
|
|
wantedDependency: 'chardet',
|
|
lockfileData: {
|
|
default: packages,
|
|
},
|
|
}),
|
|
).to.deep.equal({ version: '3.0.4' })
|
|
})
|
|
|
|
it('finds package in develop object', function () {
|
|
expect(
|
|
getDependencyVersion({
|
|
kind: 'dev',
|
|
wantedDependency: 'chardet',
|
|
lockfileData: {
|
|
default: {},
|
|
develop: packages,
|
|
},
|
|
}),
|
|
).to.deep.equal({ version: '3.0.4' })
|
|
})
|
|
|
|
it('returns version if present', function () {
|
|
expect(
|
|
getDependencyVersion({
|
|
wantedDependency: 'chardet',
|
|
lockfileData: {
|
|
default: packages,
|
|
develop: {},
|
|
},
|
|
}),
|
|
).to.deep.equal({ version: '3.0.4' })
|
|
})
|
|
|
|
it('returns (complete) ref if ref is tag', function () {
|
|
expect(
|
|
getDependencyVersion({
|
|
wantedDependency: 'django',
|
|
lockfileData: {
|
|
default: packages,
|
|
develop: {},
|
|
},
|
|
}),
|
|
).to.deep.equal({ ref: '1.11.4001' })
|
|
})
|
|
|
|
it('returns truncated ref if ref is commit hash', function () {
|
|
expect(
|
|
getDependencyVersion({
|
|
wantedDependency: 'discordlists-py',
|
|
lockfileData: {
|
|
default: packages,
|
|
develop: {},
|
|
},
|
|
}),
|
|
).to.deep.equal({ ref: '2df5a2b' })
|
|
})
|
|
|
|
it('throws if no version or ref', function () {
|
|
expect(() =>
|
|
getDependencyVersion({
|
|
wantedDependency: 'django-cms',
|
|
lockfileData: {
|
|
default: packages,
|
|
develop: {},
|
|
},
|
|
}),
|
|
)
|
|
.to.throw(InvalidParameter)
|
|
.with.property('prettyMessage', 'No version or ref for django-cms')
|
|
})
|
|
})
|