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

@@ -352,10 +352,19 @@ describe('Mail API', function () {
expect(response.statusCode).to.equal(400);
});
it('cannot set with bad addresses field', async function () {
const response = await superagent.post(`${serverUrl}/api/v1/mail/${dashboardDomain}/catch_all`)
.query({ access_token: owner.token })
.send({ addresses: [ 'user1' ] })
.ok(() => true);
expect(response.statusCode).to.equal(400);
});
it('set succeeds', async function () {
const response = await superagent.post(`${serverUrl}/api/v1/mail/${dashboardDomain}/catch_all`)
.query({ access_token: owner.token })
.send({ addresses: [ 'user1' ] });
.send({ addresses: [ `user1@${dashboardDomain}` ] });
expect(response.statusCode).to.equal(202);
});
@@ -365,7 +374,7 @@ describe('Mail API', function () {
.query({ access_token: owner.token });
expect(response.statusCode).to.equal(200);
expect(response.body.catchAll).to.eql([ 'user1' ]);
expect(response.body.catchAll).to.eql([ `user1@${dashboardDomain}` ]);
});
});