Skip to content

Commit

Permalink
Add test for filterRecipients
Browse files Browse the repository at this point in the history
  • Loading branch information
Wieln committed Oct 14, 2024
1 parent d7adae9 commit 48d2d84
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1157,4 +1157,24 @@ describe('QuestionSubmissionFormComponent', () => {
fixture.detectChanges();
expect(component.isSavedForRecipient('recipientId')).toBeTruthy();
});

it('filterRecipients: should filter recipient list in the dropdown list and update dropdown visibility', ()=>{

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

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

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

expect(component.filteredRecipients[index].length).toBe(1);
expect(component.filteredRecipients[index][0].recipientName).toBe('Alice Betsy');

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

});

0 comments on commit 48d2d84

Please sign in to comment.