Girish Ramakrishnan
2022-01-05 09:55:08 -08:00
parent 9ccf46dc8b
commit 32668b04c6
2 changed files with 22 additions and 2 deletions

View File

@@ -73,6 +73,25 @@ describe('Mail', function () {
});
});
describe('mailbox name', function () {
it('allows valid names', function () {
expect(mail._validateName('1')).to.be(null); // single char
expect(mail._validateName('ap')).to.be(null); // alpha
expect(mail._validateName('aP')).to.be(null); // caps
expect(mail._validateName('0P')).to.be(null); // number
expect(mail._validateName('a.p.x')).to.be(null); // dot
expect(mail._validateName('a-p-x')).to.be(null); // hyphen
expect(mail._validateName('a-p_x')).to.be(null); // underscore
});
it('disallows invalid names', function () {
expect(mail._validateName('@')).to.be.an(Error);
expect(mail._validateName('a+p')).to.be.an(Error);
expect(mail._validateName('a#p')).to.be.an(Error);
expect(mail._validateName('a!')).to.be.an(Error);
});
});
describe('mailboxes', function () {
it('add user mailbox succeeds', async function () {
await mail.addMailbox('girish', domain.domain, { ownerId: 'uid-0', ownerType: mail.OWNERTYPE_USER, active: true }, auditSource);