Skip to content

Commit

Permalink
feat(service_test.go): add storeMultipleContents function to handle b…
Browse files Browse the repository at this point in the history
…ulk content storage in tests

The new function `storeMultipleContents` allows for bulk storage of
content items in tests, improving the efficiency of testing scenarios
that require multiple content items to be stored.
  • Loading branch information
cybersiddhu committed Aug 15, 2024
1 parent cd8fcb2 commit 53a0e9f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/app/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,28 @@ func validateListContents(params validateListContentsParams) {
}
}

func storeMultipleContents(
client content.ContentServiceClient,
assert *require.Assertions,
count int,
name, namespace string,
) {
for i := 0; i < count; i++ {
_, err := client.StoreContent(
context.Background(),
&content.StoreContentRequest{
Data: &content.StoreContentRequest_Data{
Attributes: testutils.NewStoreContent(
fmt.Sprintf("%s-%d", name, i),
namespace,
),
},
},
)
assert.NoError(err, "expect no error from storing content")
}
}

func testContentProperties(
assert *require.Assertions,
sct, nct *content.Content,
Expand Down

0 comments on commit 53a0e9f

Please sign in to comment.