Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed May 18, 2024
1 parent 10cf58e commit 10063fe
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions lockfile/merge-lockfile-changes/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type Lockfile } from '@pnpm/lockfile-types'
import { type DepPath } from '@pnpm/types'
import { mergeLockfileChanges } from '../src'

const simpleLockfile = {
Expand Down Expand Up @@ -68,15 +69,15 @@ test('picks the newer version when dependencies differ inside package', () => {
},
lockfileVersion: '5.2',
packages: {
'/a@1.0.0': {
['/a@1.0.0' as DepPath]: {
dependencies: {
foo: '1.0.0',
},
resolution: {
integrity: '',
},
},
'/foo@1.0.0': {
['/foo@1.0.0' as DepPath]: {
resolution: {
integrity: '',
},
Expand All @@ -88,7 +89,7 @@ test('picks the newer version when dependencies differ inside package', () => {
...base,
packages: {
...base.packages,
'/a@1.0.0': {
['/a@1.0.0' as DepPath]: {
dependencies: {
linked: 'link:../1',
foo: '1.2.0',
Expand All @@ -100,28 +101,28 @@ test('picks the newer version when dependencies differ inside package', () => {
integrity: '',
},
},
'/bar@3.0.0(qar@1.0.0)': {
['/bar@3.0.0(qar@1.0.0)' as DepPath]: {
dependencies: {
qar: '1.0.0',
},
resolution: {
integrity: '',
},
},
'/zoo@4.0.0(qar@1.0.0)': {
['/zoo@4.0.0(qar@1.0.0)' as DepPath]: {
dependencies: {
qar: '1.0.0',
},
resolution: {
integrity: '',
},
},
'/foo@1.2.0': {
['/foo@1.2.0' as DepPath]: {
resolution: {
integrity: '',
},
},
'/qar@1.0.0': {
['/qar@1.0.0' as DepPath]: {
resolution: {
integrity: '',
},
Expand All @@ -132,7 +133,7 @@ test('picks the newer version when dependencies differ inside package', () => {
...base,
packages: {
...base.packages,
'/a@1.0.0': {
['/a@1.0.0' as DepPath]: {
dependencies: {
linked: 'link:../1',
foo: '1.1.0',
Expand All @@ -144,39 +145,39 @@ test('picks the newer version when dependencies differ inside package', () => {
integrity: '',
},
},
'/bar@4.0.0(qar@1.0.0)': {
['/bar@4.0.0(qar@1.0.0)' as DepPath]: {
dependencies: {
qar: '1.0.0',
},
resolution: {
integrity: '',
},
},
'/zoo@3.0.0(qar@1.0.0)': {
['/zoo@3.0.0(qar@1.0.0)' as DepPath]: {
dependencies: {
qar: '1.0.0',
},
resolution: {
integrity: '',
},
},
'/foo@1.1.0': {
['/foo@1.1.0' as DepPath]: {
resolution: {
integrity: '',
},
},
'/qar@1.0.0': {
['/qar@1.0.0' as DepPath]: {
resolution: {
integrity: '',
},
},
},
}
)
expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.linked).toBe('link:../1')
expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.foo).toBe('1.2.0')
expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.bar).toBe('4.0.0(qar@1.0.0)')
expect(mergedLockfile.packages?.['/a@1.0.0'].dependencies?.zoo).toBe('4.0.0(qar@1.0.0)')
expect(mergedLockfile.packages?.['/a@1.0.0' as DepPath].dependencies?.linked).toBe('link:../1')
expect(mergedLockfile.packages?.['/a@1.0.0' as DepPath].dependencies?.foo).toBe('1.2.0')
expect(mergedLockfile.packages?.['/a@1.0.0' as DepPath].dependencies?.bar).toBe('4.0.0(qar@1.0.0)')
expect(mergedLockfile.packages?.['/a@1.0.0' as DepPath].dependencies?.zoo).toBe('4.0.0(qar@1.0.0)')
expect(Object.keys(mergedLockfile.packages ?? {}).sort()).toStrictEqual([
'/a@1.0.0',
'/bar@3.0.0(qar@1.0.0)',
Expand All @@ -195,15 +196,15 @@ test('prefers our lockfile resolutions when it has newer packages', () => {
{
...simpleLockfile,
packages: {
'/foo@1.0.0': {
['/foo@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
},
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
},
'/bar@1.0.0': {
['/bar@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
Expand All @@ -213,23 +214,23 @@ test('prefers our lockfile resolutions when it has newer packages', () => {
{
...simpleLockfile,
packages: {
'/foo@1.0.0': {
['/foo@1.0.0' as DepPath]: {
dependencies: {
bar: '1.1.0',
},
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
},
'/bar@1.1.0': {
['/bar@1.1.0' as DepPath]: {
dependencies: {
qar: '1.0.0',
},
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
},
'/qar@1.0.0': {
['/qar@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
Expand Down Expand Up @@ -276,15 +277,15 @@ test('prefers our lockfile resolutions when it has newer packages', () => {
{
...simpleLockfile,
packages: {
'/foo@1.0.0': {
['/foo@1.0.0' as DepPath]: {
dependencies: {
bar: '1.0.0',
},
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
},
'/bar@1.0.0': {
['/bar@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
Expand All @@ -294,23 +295,23 @@ test('prefers our lockfile resolutions when it has newer packages', () => {
{
...simpleLockfile,
packages: {
'/foo@1.0.0': {
['/foo@1.0.0' as DepPath]: {
dependencies: {
bar: '1.1.0',
},
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
},
'/bar@1.1.0': {
['/bar@1.1.0' as DepPath]: {
dependencies: {
qar: '1.0.0',
},
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
},
'/qar@1.0.0': {
['/qar@1.0.0' as DepPath]: {
resolution: {
integrity: 'sha512-aBVzCAzfyApU0gg36QgCpJixGtYwuQ4djrn11J+DTB5vE4OmBPuZiulgTCA9ByULgVAyNV2CTpjjvZmxzukSLw==',
},
Expand Down

0 comments on commit 10063fe

Please sign in to comment.