From dda5564a3a3968559349e5b2f2bfb84ffb259409 Mon Sep 17 00:00:00 2001 From: williamfzc <178894043@qq.com> Date: Sun, 27 Aug 2023 14:35:35 +0800 Subject: [PATCH] fix: typo in lockfile >= 6.0 --- pnpm/handler.go | 2 +- pnpm/handler_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pnpm/handler.go b/pnpm/handler.go index 1ad01c7..f73d830 100644 --- a/pnpm/handler.go +++ b/pnpm/handler.go @@ -336,7 +336,7 @@ func readLockData(lockData map[string]interface{}) ([]dependency, error) { dep := dependency{} var name, version, belonging string - if lockfileVersionNum > 6.0 { + if lockfileVersionNum >= 6.0 { name, version, belonging = splitPackageNameAndVersionV6(pkgName) } else { name, version, belonging = splitPackageNameAndVersionLegacy(pkgName) diff --git a/pnpm/handler_test.go b/pnpm/handler_test.go index 66526e3..4054240 100644 --- a/pnpm/handler_test.go +++ b/pnpm/handler_test.go @@ -100,8 +100,8 @@ func TestListAllModules(t *testing.T) { for _, mod := range mods { if mod.Name == "axios" { h := fmt.Sprintf("%x", sha256.Sum256([]byte(mod.Name))) - assert.Equal(t, "0.19.0", mod.Version) - assert.Equal(t, "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", mod.PackageDownloadLocation) + assert.Equal(t, "0.19.2", mod.Version) + assert.Equal(t, "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", mod.PackageDownloadLocation) assert.Equal(t, meta.HashAlgorithm("SHA256"), mod.Checksum.Algorithm) assert.Equal(t, h, mod.Checksum.Value) assert.Equal(t, "Copyright (c) 2014-present Matt Zabriskie", mod.Copyright) @@ -116,8 +116,8 @@ func TestListAllModules(t *testing.T) { } h := fmt.Sprintf("%x", sha256.Sum256([]byte(mod.Name))) - assert.Equal(t, "16.8.6", mod.Version) - assert.Equal(t, "https://registry.npmjs.org/react/-/react-16.8.6.tgz", mod.PackageDownloadLocation) + assert.Equal(t, "16.14.0", mod.Version) + assert.Equal(t, "https://registry.npmjs.org/react/-/react-16.14.0.tgz", mod.PackageDownloadLocation) assert.Equal(t, meta.HashAlgorithm("SHA256"), mod.Checksum.Algorithm) assert.Equal(t, h, mod.Checksum.Value) assert.Equal(t, "Copyright (c) Facebook, Inc. and its affiliates.", mod.Copyright) @@ -128,8 +128,8 @@ func TestListAllModules(t *testing.T) { if mod.Name == "react-dom" { h := fmt.Sprintf("%x", sha256.Sum256([]byte(mod.Name))) - assert.Equal(t, "16.8.6", mod.Version) - assert.Equal(t, "https://registry.npmjs.org/react-dom/-/react-dom-16.8.6.tgz", mod.PackageDownloadLocation) + assert.Equal(t, "16.14.0", mod.Version) + assert.Equal(t, "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", mod.PackageDownloadLocation) assert.Equal(t, meta.HashAlgorithm("SHA256"), mod.Checksum.Algorithm) assert.Equal(t, h, mod.Checksum.Value) assert.Equal(t, "Copyright (c) Facebook, Inc. and its affiliates.", mod.Copyright)