mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-04 05:56:24 -04:00
test: write()
This commit is contained in:
41
test/read.ts
41
test/read.ts
@@ -3,6 +3,7 @@ import {
|
||||
readCurrent,
|
||||
readPrivate,
|
||||
read,
|
||||
write,
|
||||
writeWantedOnly,
|
||||
} from 'pnpm-shrinkwrap'
|
||||
import test = require('tape')
|
||||
@@ -97,3 +98,43 @@ test('writeWantedOnly()', async t => {
|
||||
t.deepEqual(await readWanted(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('write()', async t => {
|
||||
const projectPath = tempy.directory()
|
||||
const wantedShrinkwrap = {
|
||||
shrinkwrapVersion: 3,
|
||||
registry: 'https://registry.npmjs.org',
|
||||
dependencies: {
|
||||
'is-positive': '1.0.0',
|
||||
'is-negative': '1.0.0',
|
||||
},
|
||||
specifiers: {
|
||||
'is-positive': '^1.0.0',
|
||||
'is-negative': '^1.0.0',
|
||||
},
|
||||
packages: {
|
||||
'/is-positive/1.0.0': {
|
||||
resolution: {
|
||||
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g='
|
||||
}
|
||||
},
|
||||
'/is-negative/1.0.0': {
|
||||
dependencies: {
|
||||
'is-positive': '2.0.0',
|
||||
},
|
||||
resolution: {
|
||||
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g='
|
||||
}
|
||||
},
|
||||
'/is-positive/2.0.0': {
|
||||
resolution: {
|
||||
integrity: 'sha1-ChbBDewTLAqLCzb793Fo5VDvg/g='
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
await write(projectPath, wantedShrinkwrap, wantedShrinkwrap)
|
||||
t.deepEqual(await readCurrent(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.deepEqual(await readWanted(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.end()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user