Skip to content

Commit

Permalink
add test for filterRecipients empty case
Browse files Browse the repository at this point in the history
  • Loading branch information
Yixsun committed Oct 19, 2024
1 parent dd9d784 commit a476c67
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1203,4 +1203,23 @@ describe('QuestionSubmissionFormComponent', () => {
expect(component.dropdownVisible[index]).toBe(true);
});

it('filterRecipients: should filter recipient list and resuld should be empty and dropdown should not be visible', ()=>{

const value = 'alice';
const index = 0;

component.model.recipientList = [
{ recipientIdentifier: '0', recipientName: 'Matty Betsy' },
{ recipientIdentifier: '1', recipientName: 'Benny Charles' }
];

component.getSelectionOptionLabel = (recipient: any) => recipient.recipientName;
component.filterRecipients(value, index);

expect(component.filteredRecipients[index].length).toBe(0);
expect(component.filteredRecipients[index][0]).toBeUndefined();

expect(component.dropdownVisible[index]).toBe(false);
})

});

0 comments on commit a476c67

Please sign in to comment.