Update security policies jest api tests to test component

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

The following discussion from !196426 (merged) should be addressed:

  • @slashmanov started a discussion:

    suggestion: these specs are actually not testing what we expect from the component. We'd like this component to render items in the dropdown. We should test exactly that: given the input, after we wait for requests verify that the component displays correct items in the dropdown.

  • currently the security policies jest tests test api requests instead of what we expect from the component (e.g. testing how the data is used by the component, usually in the form of a dropdown's items)

  • this makes the tests more fragile as we are caring about the implementation instead of the outcome (e.g. we should be able to swap out the requests without the tests breaking as long as the component gets the right data)

Implementation

image

Edited by 🤖 GitLab Bot 🤖