Skip to content

Commit

Permalink
refactor(core): Changed tests to use a constants platforms
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Avelar <[email protected]>
  • Loading branch information
felipe-avelar authored Nov 19, 2021
1 parent efc6bcf commit 241c6a0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions e2e/utils/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
"golang.org/x/net/html"
)

var availablePlatforms = map[string]string{
"Ansible": "ansible",
"CloudFormation": "cloudFormation",
"Common": "common",
"Dockerfile": "dockerfile",
"Kubernetes": "k8s",
"OpenAPI": "openAPI",
"Terraform": "terraform",
"AzureResourceManager": "azureResourceManager",
var availablePlatforms = initPlatforms()

func initPlatforms() map[string]string {
platforms := make(map[string]string)
for k, v := range constants.AvailablePlatforms {
platforms[k] = v
}
platforms["Common"] = "common"
return platforms
}

// HTMLValidation executes many asserts to validate the HTML Report
Expand Down
6 changes: 3 additions & 3 deletions internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ var (
// AvailablePlatforms - All platforms available
AvailablePlatforms = map[string]string{
"Ansible": "ansible",
"CloudFormation": "cloudformation",
"CloudFormation": "cloudFormation",
"Dockerfile": "dockerfile",
"Kubernetes": "k8s",
"OpenAPI": "openAPI",
"Terraform": "terraform",
"OpenAPI": "openapi",
"AzureResourceManager": "azureresourcemanager",
"AzureResourceManager": "azureResourceManager",
}

// AvailableSeverities - All severities available
Expand Down
22 changes: 11 additions & 11 deletions test/queries_content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,8 @@ var (
}

// TODO uncomment this test once all metadata are fixed
availablePlatforms = map[string]string{
"Ansible": "ansible",
"CloudFormation": "cloudFormation",
"Common": "common",
"Dockerfile": "dockerfile",
"Kubernetes": "k8s",
"OpenAPI": "openAPI",
"Terraform": "terraform",
"AzureResourceManager": "azureResourceManager",
}
platformKeys = MapToStringSlice(availablePlatforms)
availablePlatforms = initPlatforms()
platformKeys = MapToStringSlice(availablePlatforms)

CategoriesKeys = MapToStringSlice(constants.AvailableCategories)

Expand Down Expand Up @@ -120,6 +111,15 @@ var (
}
)

func initPlatforms() map[string]string {
platforms := make(map[string]string)
for k, v := range constants.AvailablePlatforms {
platforms[k] = v
}
platforms["Common"] = "common"
return platforms
}

func TestQueriesContent(t *testing.T) {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: io.Discard})

Expand Down

0 comments on commit 241c6a0

Please sign in to comment.