mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 17:03:17 +01:00
30 lines
774 B
Go
30 lines
774 B
Go
package syftjson
|
|
|
|
import (
|
|
"flag"
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/internal/formats/common/testutils"
|
|
"github.com/anchore/syft/syft/format"
|
|
)
|
|
|
|
var updateJson = flag.Bool("update-json", false, "update the *.golden files for json presenters")
|
|
|
|
func TestJSONDirectoryPresenter(t *testing.T) {
|
|
catalog, metadata, distro := testutils.DirectoryInput(t)
|
|
testutils.AssertPresenterAgainstGoldenSnapshot(t,
|
|
format.NewPresenter(encoder, catalog, &metadata, distro),
|
|
*updateJson,
|
|
)
|
|
}
|
|
|
|
func TestJSONImagePresenter(t *testing.T) {
|
|
testImage := "image-simple"
|
|
catalog, metadata, distro := testutils.ImageInput(t, testImage)
|
|
testutils.AssertPresenterAgainstGoldenImageSnapshot(t,
|
|
format.NewPresenter(encoder, catalog, &metadata, distro),
|
|
testImage,
|
|
*updateJson,
|
|
)
|
|
}
|