Files
pnpm/packages/lockfile-utils/test/pkgSnapshotToResolution.ts
Jason Staten 1af7c6d4bc test: migrate more tests to Jest
* chore: local-resolver to jest

* chore: lockfile-file to jest

* chore: lockfile-utils to jest

* style: fix

PR #2909
ref #2858
2020-10-04 15:17:06 +03:00

37 lines
1.3 KiB
TypeScript

import { pkgSnapshotToResolution } from '@pnpm/lockfile-utils'
test('pkgSnapshotToResolution()', () => {
expect(pkgSnapshotToResolution('/foo/1.0.0', {
resolution: {
integrity: 'AAAA',
},
}, { default: 'https://registry.npmjs.org/' })).toEqual({
integrity: 'AAAA',
registry: 'https://registry.npmjs.org/',
tarball: 'https://registry.npmjs.org/foo/-/foo-1.0.0.tgz',
})
expect(pkgSnapshotToResolution('/@mycompany/mypackage/2.0.0', {
resolution: {
integrity: 'AAAA',
tarball: '@mycompany/mypackage/-/@mycompany/mypackage-2.0.0.tgz',
},
}, { default: 'https://registry.npmjs.org/', '@mycompany': 'https://mycompany.jfrog.io/mycompany/api/npm/npm-local/' })).toEqual({
integrity: 'AAAA',
registry: 'https://mycompany.jfrog.io/mycompany/api/npm/npm-local/',
tarball: 'https://mycompany.jfrog.io/mycompany/api/npm/npm-local/@mycompany/mypackage/-/@mycompany/mypackage-2.0.0.tgz',
})
expect(pkgSnapshotToResolution('/foo/1.0.0', {
resolution: {
integrity: 'AAAA',
registry: 'https://npm.pkg.github.com/',
tarball: 'https://npm.pkg.github.com/download/@foo/bar/1.0.0/aaa',
},
}, { default: 'https://registry.npmjs.org/' })).toEqual({
integrity: 'AAAA',
registry: 'https://npm.pkg.github.com/',
tarball: 'https://npm.pkg.github.com/download/@foo/bar/1.0.0/aaa',
})
})