Skip to content

Commit

Permalink
fixed static analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
eranturgeman committed Jul 26, 2023
1 parent d5d9da1 commit 3dbeb76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion build/utils/yarn.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func GetYarnDependencies(executablePath, srcPath string, packageInfo *PackageInf
if responseStr == "" {
return
}
err = nil
}

if isV2AndAbove {
Expand Down
13 changes: 7 additions & 6 deletions build/utils/yarn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,26 @@ func CheckGetYarnDependencies(t *testing.T, versionDir string, expectedLocators
// (i.e. new dependencies added) make sure to fix the checks below
assert.Len(t, dependenciesMap, 6)
for key, val := range dependenciesMap {
if strings.HasPrefix(key, "react") {
switch {
case strings.HasPrefix(key, "react"):
assert.Equal(t, val.Details.Version, "18.2.0")
assert.True(t, val.Details.Dependencies != nil)
subDependencies := []string{"loose-envify"}
for _, depPointer := range val.Details.Dependencies {
packageName := depPointer.Locator[:strings.Index(depPointer.Locator[1:], "@")+1]
assert.Contains(t, subDependencies, packageName)
}
} else if strings.HasPrefix(key, "xml") {
case strings.HasPrefix(key, "xml"):
assert.Equal(t, val.Details.Version, "1.0.1")
assert.True(t, val.Details.Dependencies == nil)
} else if strings.HasPrefix(key, "json") {
case strings.HasPrefix(key, "json"):
assert.Equal(t, val.Details.Version, "9.0.6")
assert.True(t, val.Details.Dependencies == nil)
} else if strings.HasPrefix(key, "loose-envify") {
case strings.HasPrefix(key, "loose-envify"):
assert.True(t, val.Details.Dependencies != nil)
} else if strings.HasPrefix(key, "js-tokens") {
case strings.HasPrefix(key, "js-tokens"):
assert.True(t, val.Details.Dependencies == nil)
} else {
default:
if key != root.Value {
assert.Error(t, errors.New("Package"+key+"should not be inside the dependencyMap"))
}
Expand Down

0 comments on commit 3dbeb76

Please sign in to comment.