mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-09 08:26:27 -04:00
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { pkgSnapshotToResolution } from '@pnpm/lockfile-utils'
|
|
import test = require('tape')
|
|
|
|
test('pkgSnapshotToResolution()', (t) => {
|
|
t.deepEqual(pkgSnapshotToResolution('/foo/1.0.0', {
|
|
resolution: {
|
|
integrity: 'AAAA',
|
|
},
|
|
}, { default: 'https://registry.npmjs.org/' }), {
|
|
integrity: 'AAAA',
|
|
registry: 'https://registry.npmjs.org/',
|
|
tarball: 'https://registry.npmjs.org/foo/-/foo-1.0.0.tgz',
|
|
})
|
|
|
|
t.deepEqual(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/' }), {
|
|
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',
|
|
})
|
|
|
|
t.deepEqual(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/' }), {
|
|
integrity: 'AAAA',
|
|
registry: 'https://npm.pkg.github.com/',
|
|
tarball: 'https://npm.pkg.github.com/download/@foo/bar/1.0.0/aaa',
|
|
})
|
|
|
|
t.end()
|
|
})
|