github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/pkg/fanal/analyzer/config/azurearm/azurearm_test.go (about)

     1  package azurearm
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  	"github.com/stretchr/testify/require"
     8  
     9  	"github.com/devseccon/trivy/pkg/fanal/analyzer"
    10  )
    11  
    12  func Test_azureARMConfigAnalyzer_Required(t *testing.T) {
    13  	tests := []struct {
    14  		name     string
    15  		filePath string
    16  		want     bool
    17  	}{
    18  		{
    19  			name:     "json",
    20  			filePath: "test.json",
    21  			want:     true,
    22  		},
    23  		{
    24  			name:     "yaml",
    25  			filePath: "test.yaml",
    26  			want:     false,
    27  		},
    28  	}
    29  	for _, tt := range tests {
    30  		t.Run(tt.name, func(t *testing.T) {
    31  			a, err := newAzureARMConfigAnalyzer(analyzer.AnalyzerOptions{})
    32  			require.NoError(t, err)
    33  			assert.Equal(t, tt.want, a.Required(tt.filePath, nil))
    34  		})
    35  	}
    36  }