Skip to content

Commit

Permalink
fix: update test to confirm fix for GetKeys()
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanSpeakEasy authored and daveshanley committed Aug 26, 2024
1 parent 161a41f commit c46147c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions datamodel/low/base/security_requirement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
)

func TestSecurityRequirement_Build(t *testing.T) {

yml := `one:
- two
- three
Expand All @@ -40,7 +39,7 @@ one:
_ = sr2.Build(context.Background(), nil, idxNode2.Content[0], nil)

assert.Equal(t, 2, orderedmap.Len(sr.Requirements.Value))
assert.Len(t, sr.GetKeys(), 2)
assert.Equal(t, []string{"one", "four"}, sr.GetKeys())
assert.Len(t, sr.FindRequirement("one"), 2)
assert.Equal(t, sr.Hash(), sr2.Hash())
assert.Nil(t, sr.FindRequirement("i-do-not-exist"))
Expand All @@ -49,7 +48,6 @@ one:
}

func TestSecurityRequirement_TestEmptyReq(t *testing.T) {

yml := `one:
- two
- {}`
Expand All @@ -61,14 +59,12 @@ func TestSecurityRequirement_TestEmptyReq(t *testing.T) {
_ = sr.Build(context.Background(), nil, idxNode.Content[0], nil)

assert.Equal(t, 1, orderedmap.Len(sr.Requirements.Value))
assert.Len(t, sr.GetKeys(), 1)
assert.Equal(t, []string{"one"}, sr.GetKeys())
assert.True(t, sr.ContainsEmptyRequirement)

}

func TestSecurityRequirement_TestEmptyContent(t *testing.T) {
var sr SecurityRequirement
_ = sr.Build(context.Background(), nil, &yaml.Node{}, nil)
assert.True(t, sr.ContainsEmptyRequirement)

}

0 comments on commit c46147c

Please sign in to comment.