mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-09-10 15:14:40 +08:00
added test for deleting queue entries
This commit is contained in:
parent
ac7073c852
commit
b2f8c1fd41
2 changed files with 36 additions and 2 deletions
|
@ -4996,8 +4996,6 @@ components:
|
||||||
- type: object
|
- type: object
|
||||||
- type: string
|
- type: string
|
||||||
SubmitStoredMessageRequest:
|
SubmitStoredMessageRequest:
|
||||||
required:
|
|
||||||
- deleteFiles
|
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
deleteFiles:
|
deleteFiles:
|
||||||
|
|
|
@ -522,5 +522,41 @@ describe('API tests', function () {
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should create a draft message and submit for delivery', async () => {
|
||||||
|
const message = {
|
||||||
|
from: {
|
||||||
|
name: 'test tester1',
|
||||||
|
address: 'testuser1@example.com'
|
||||||
|
},
|
||||||
|
to: [
|
||||||
|
{ name: 'test tester2', address: 'testuser2@example.com' },
|
||||||
|
{ name: 'test tester3', address: 'testuser3@example.com' }
|
||||||
|
],
|
||||||
|
draft: true,
|
||||||
|
subject: 'hello world',
|
||||||
|
text: 'Hello hello world!',
|
||||||
|
html: '<p>Hello hello world!</p>'
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await server.post(`/users/${userId}/mailboxes/${inbox}/messages`).send(message).expect(200);
|
||||||
|
expect(response.body.success).to.be.true;
|
||||||
|
expect(response.body.message.id).to.be.gt(0);
|
||||||
|
|
||||||
|
let sendTime = new Date(Date.now() + 24 * 3600 * 1000).toISOString();
|
||||||
|
const submitResponse = await server
|
||||||
|
.post(`/users/${userId}/mailboxes/${inbox}/messages/${response.body.message.id}/submit`)
|
||||||
|
.send({ sendTime })
|
||||||
|
.expect(200);
|
||||||
|
expect(submitResponse.body.queueId).to.exist;
|
||||||
|
|
||||||
|
const sentMessageDataResponse = await server.get(
|
||||||
|
`/users/${userId}/mailboxes/${submitResponse.body.message.mailbox}/messages/${submitResponse.body.message.id}`
|
||||||
|
);
|
||||||
|
expect(sentMessageDataResponse.body.outbound[0].queueId).to.equal(submitResponse.body.queueId);
|
||||||
|
|
||||||
|
const deleteResponse = await server.delete(`/users/${userId}/outbound/${submitResponse.body.queueId}`).expect(200);
|
||||||
|
expect(deleteResponse.body.deleted).to.equal(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue