Skip to content

Commit

Permalink
Add publish test for multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Mar 6, 2024
1 parent 02f6dbc commit 15eda5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions artifactory/commands/npm/publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import (

func TestReadPackageInfoFromTarball(t *testing.T) {
npmPublish := NewNpmPublishCommand()
for index, file := range npmPublish.packedFilesPath {
npmPublish.packedFilesPath[index] = filepath.Join("..", "testdata", "npm", "npm-example-0.0.3.tgz")
err := npmPublish.readPackageInfoFromTarball(file)
assert.NoError(t, err)
npmPublish.packedFilesPath = append(npmPublish.packedFilesPath, filepath.Join("..", "testdata", "npm", "npm-example-0.0.3.tgz"))
npmPublish.packedFilesPath = append(npmPublish.packedFilesPath, filepath.Join("..", "testdata", "npm", "npm-example-0.0.4.tgz"))

err := npmPublish.readPackageInfoFromTarball(npmPublish.packedFilesPath[0])
assert.NoError(t, err)
assert.Equal(t, "npm-example", npmPublish.packageInfo.Name)
assert.Equal(t, "0.0.3", npmPublish.packageInfo.Version)

err = npmPublish.readPackageInfoFromTarball(npmPublish.packedFilesPath[1])
assert.NoError(t, err)
assert.Equal(t, "npm-example", npmPublish.packageInfo.Name)
assert.Equal(t, "0.0.4", npmPublish.packageInfo.Version)

assert.Equal(t, "npm-example", npmPublish.packageInfo.Name)
assert.Equal(t, "0.0.3", npmPublish.packageInfo.Version)
}
}
Binary file not shown.

0 comments on commit 15eda5f

Please sign in to comment.