mail: require catch all to be absolute

This commit is contained in:
Girish Ramakrishnan
2022-09-11 11:15:21 +02:00
parent 2a93c703ef
commit 4e75694ac6
5 changed files with 42 additions and 5 deletions

View File

@@ -40,11 +40,16 @@ describe('Mail', function () {
expect(mailConfig.mailFromValidation).to.be(false);
});
it('can set catch all address', async function () {
await mail.setCatchAllAddress(domain.domain, [ 'user1', 'user2' ]);
it('cannot set invalid catch all address', async function () {
const [error] = await safe(mail.setCatchAllAddress(domain.domain, [ 'user1' ]));
expect(error.reason).to.be(BoxError.BAD_FIELD);
});
it('can set invalid catch all address', async function () {
await mail.setCatchAllAddress(domain.domain, [ `user1@${domain.domain}`, `user2@${domain.domain}` ]);
const mailConfig = await mail.getDomain(domain.domain);
expect(mailConfig.catchAll).to.eql([ 'user1', 'user2' ]);
expect(mailConfig.catchAll).to.eql([ `user1@${domain.domain}`, `user2@${domain.domain}` ]);
});
it('can set mail relay', async function () {