github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/pkg/scanners/cloudformation/parser/pseudo_parameters_test.go (about)

     1  package parser
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func Test_Raw(t *testing.T) {
    10  	tests := []struct {
    11  		name     string
    12  		key      string
    13  		expected interface{}
    14  	}{
    15  		{
    16  			name:     "parameter with a string type value",
    17  			key:      "AWS::AccountId",
    18  			expected: "123456789012",
    19  		},
    20  		{
    21  			name:     "a parameter with a list type value",
    22  			key:      "AWS::NotificationARNs",
    23  			expected: []string{"notification::arn::1", "notification::arn::2"},
    24  		},
    25  	}
    26  
    27  	for _, tt := range tests {
    28  		t.Run(tt.name, func(t *testing.T) {
    29  			if val, ok := pseudoParameters[tt.key]; ok {
    30  				assert.Equal(t, tt.expected, val.getRawValue())
    31  			} else {
    32  				t.Fatal("unexpected parameter key")
    33  			}
    34  		})
    35  	}
    36  }