github.com/anchore/syft@v1.38.2/syft/pkg/cataloger/dart/cataloger_test.go (about)

     1  package dart
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
     7  )
     8  
     9  func TestPubspecLockCataloger_Globs(t *testing.T) {
    10  	tests := []struct {
    11  		name     string
    12  		fixture  string
    13  		expected []string
    14  	}{
    15  		{
    16  			name:    "obtain pubspec lock files",
    17  			fixture: "test-fixtures/glob-paths/lock",
    18  			expected: []string{
    19  				"src/pubspec.lock",
    20  			},
    21  		},
    22  	}
    23  
    24  	for _, test := range tests {
    25  		t.Run(test.name, func(t *testing.T) {
    26  			pkgtest.NewCatalogTester().
    27  				FromDirectory(t, test.fixture).
    28  				ExpectsResolverContentQueries(test.expected).
    29  				TestCataloger(t, NewPubspecLockCataloger())
    30  		})
    31  	}
    32  }
    33  
    34  func TestPubspecCataloger_Globs(t *testing.T) {
    35  	tests := []struct {
    36  		name     string
    37  		fixture  string
    38  		expected []string
    39  	}{
    40  		{
    41  			name:    "obtain pubspec files",
    42  			fixture: "test-fixtures/glob-paths/spec",
    43  			expected: []string{
    44  				"pubspec.yml",
    45  				"pubspec.yaml",
    46  			},
    47  		},
    48  	}
    49  
    50  	for _, test := range tests {
    51  		t.Run(test.name, func(t *testing.T) {
    52  			pkgtest.NewCatalogTester().
    53  				FromDirectory(t, test.fixture).
    54  				ExpectsResolverContentQueries(test.expected).
    55  				TestCataloger(t, NewPubspecCataloger())
    56  		})
    57  	}
    58  }