-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(classification): Apps to Integrations name change #3726
Conversation
d505d10
to
811fc18
Compare
811fc18
to
fdce2c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
test('should render SecurityControls with Integration label when using SHORT controlsFormat and shouldDisplayAppsAsIntegrations is true', () => { | ||
wrapper.setProps({ controlsFormat: SHORT, shouldDisplayAppsAsIntegrations: true }); | ||
expect(wrapper.find('SecurityControlsItem').prop('message').id).toBe( | ||
messages.shortSharingDownloadIntegration.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be asserting against the hardcoded string, not the id or the variable, if the message changes, none of the new tests will fail if someone else accidentally changes it. this goes for all the tests you are asserting below checking for the correct message to appear.
also this component small enough to convert the test file to RTL where you could see the literal string in the dom so that its not mocked in the rest of the tests.
'should include correct message when integration download is restricted by %s and integrations are less than maxAppCount and shouldDisplayAppsAsIntegrations is true', | ||
listType => { | ||
accessPolicy = { | ||
app: { | ||
accessLevel: listType, | ||
apps: [{ displayText: 'a' }, { displayText: 'b' }, { displayText: 'c' }], | ||
}, | ||
}; | ||
const expectedMessage = integrationRestrictionsMessageMap[listType][WITH_APP_LIST]; | ||
|
||
expect(expectedMessage).toBeTruthy(); | ||
expect(getFullSecurityControlsMessages(accessPolicy, 3, true)).toEqual([ | ||
{ | ||
message: { | ||
...expectedMessage, | ||
values: { appNames: 'a, b, c' }, | ||
}, | ||
}, | ||
]); | ||
}, | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need assert against the hardcoded message also, the test is essentially check if the input is provide the correct messages so using the variable here might not be useful because someone could still change the message and these unit tests will still pass same with the test below.
if we do not care about the message in these unit tests and we are just testing the function itself, then maybe updating the test name to reflect that
Replaced 'application' references in Classification modal with 'integration', based on optional flag variable (by default set to false, so I won't break existing code and will display 'application' as usual). When flag is passed as 'True' then 'Integrations' will be displayed, otherwise 'Applications'. Also, unit tests are added for related changes.