'The sast scanner finds a critical vulnerability in an open merge request targeting the main branch.',
]);
});
it('returns multiple rules with different number of branches as human-readable strings',()=>{
expect(humanizeRules(mockRules)).toStrictEqual([
'The sast scanner finds a critical vulnerability in an open merge request targeting the main branch.',
'The dast or sast scanners find info or critical vulnerabilities in an open merge request targeting the master or main branches.',
]);
});
});
describe('humanizeAction',()=>{
it('returns a single action as a human-readable string for user approvers only',()=>{
expect(humanizeAction(mockActions[0])).toEqual(
'Require 2 approvals from o.leticia.conner if any of the following occur:',
);
});
it('returns a single action as a human-readable string for group approvers only',()=>{
expect(humanizeAction(mockActions[1])).toEqual(
'Require 2 approvals from members of the group security_group/all_members if any of the following occur:',
);
});
it('returns a single action as a human-readable string for group approvers ids only',()=>{
expect(humanizeAction(mockActions[2])).toEqual(
'Require 2 approvals from members of the group with id 10 if any of the following occur:',
);
});
it('returns a single action as a human-readable string for user approvers ids only',()=>{
expect(humanizeAction(mockActions[3])).toEqual(
'Require 2 approvals from user with id 5 if any of the following occur:',
);
});
it('returns a single action as a human-readable string with all approvers types',()=>{
expect(humanizeAction(mockActions[4])).toEqual(
'Require 2 approvals from o.leticia.conner or user with id 5 or members of the group security_group/all_members or members of the group with id 10 if any of the following occur:',