Skip to content

Commit

Permalink
Add test for EmailAddress class
Browse files Browse the repository at this point in the history
  • Loading branch information
MSJohnnyLee committed Sep 28, 2024
1 parent 753866f commit 4eaab1f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/teams-js/test/public/meeting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2266,4 +2266,26 @@ describe('meeting', () => {
});
});
});
describe('utility', () => {
const invalidEmails = ['@@domain.com', 'firstname [email protected]', 'name@domain'];
invalidEmails.forEach((invalidEmail) => {
it('should throw errors for invalid email addresses', () => {
expect(() => new meeting.EmailAddress(invalidEmail)).toThrowError(
'Input email address does not have the correct format.',
);
});
});
const validEmails = [
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
];
validEmails.forEach((validEmail) => {
it('should not throw errors for valid email addresses', () => {
const email = new meeting.EmailAddress(validEmail);
expect(email.toString()).toBe(validEmail);
});
});
});
});

0 comments on commit 4eaab1f

Please sign in to comment.