Skip to content

Commit

Permalink
fix(test): add coverage from the exported functionality testing
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtkeller committed Nov 6, 2024
1 parent 75cb1f7 commit d45ca8b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pkg/common/oscal/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package oscal_test
import (
"os"
"reflect"
"strings"
"testing"

oscalTypes "github.com/defenseunicorns/go-oscal/src/types/oscal-1-1-2"
Expand Down Expand Up @@ -152,10 +153,10 @@ func TestComponentFromCatalog(t *testing.T) {
name: "Valid test of component from Catalog",
data: *catalog,
title: "Component Title",
requirements: []string{"ac-1", "ac-3", "ac-3.2", "ac-4"},
requirements: []string{"ac-1", "ac-3", "ac-3.2", "ac-4", "ac-4.4"},
remarks: []string{"statement"},
source: "https://raw.githubusercontent.com/usnistgov/oscal-content/master/nist.gov/SP800-53/rev5/json/NIST_SP-800-53_rev5_catalog.json",
wantReqLen: 4,
wantReqLen: 5,
wantErr: false,
},
{
Expand Down Expand Up @@ -208,6 +209,9 @@ func TestComponentFromCatalog(t *testing.T) {

implementedRequirements := make([]string, 0)
for _, requirement := range controlImplementation.ImplementedRequirements {
if strings.Contains(requirement.Remarks, "{{ insert: param,") {
t.Errorf("Expected all parameters to be rendered - found: %s/n", requirement.Remarks)
}
implementedRequirements = append(implementedRequirements, requirement.ControlId)
}

Expand Down

0 comments on commit d45ca8b

Please sign in to comment.