diff --git a/packages/teams-js/test/public/meeting.spec.ts b/packages/teams-js/test/public/meeting.spec.ts index e4e8fedc49..466a6cd2ba 100644 --- a/packages/teams-js/test/public/meeting.spec.ts +++ b/packages/teams-js/test/public/meeting.spec.ts @@ -2266,4 +2266,26 @@ describe('meeting', () => { }); }); }); + describe('utility', () => { + const invalidEmails = ['@@domain.com', 'firstname lastname@domain.com', '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@domain.com', + 'firstname+lastname@domain.com', + '123@domain.com', + 'name@domain.subdomain.com', + ]; + validEmails.forEach((validEmail) => { + it('should not throw errors for valid email addresses', () => { + const email = new meeting.EmailAddress(validEmail); + expect(email.toString()).toBe(validEmail); + }); + }); + }); });