mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
test: fix digest test
This commit is contained in:
@@ -140,6 +140,7 @@ Digest.send = async function (data) {
|
|||||||
batch: 100,
|
batch: 100,
|
||||||
});
|
});
|
||||||
winston.info(`[user/jobs] Digest (${data.interval}) sending completed. ${emailsSent} emails sent.`);
|
winston.info(`[user/jobs] Digest (${data.interval}) sending completed. ${emailsSent} emails sent.`);
|
||||||
|
return emailsSent;
|
||||||
};
|
};
|
||||||
|
|
||||||
Digest.getDeliveryTimes = async (start, stop) => {
|
Digest.getDeliveryTimes = async (start, stop) => {
|
||||||
|
|||||||
@@ -1493,7 +1493,9 @@ describe('User', () => {
|
|||||||
it('should send digests', async () => {
|
it('should send digests', async () => {
|
||||||
const oldValue = meta.config.includeUnverifiedEmails;
|
const oldValue = meta.config.includeUnverifiedEmails;
|
||||||
meta.config.includeUnverifiedEmails = true;
|
meta.config.includeUnverifiedEmails = true;
|
||||||
const uid = await User.create({ username: 'digest', email: 'email@test.com' });
|
const uid = await User.create({ username: 'digest' });
|
||||||
|
await User.setUserField(uid, 'email', 'email@test.com');
|
||||||
|
await User.email.confirmByUid(uid);
|
||||||
await User.digest.execute({
|
await User.digest.execute({
|
||||||
interval: 'day',
|
interval: 'day',
|
||||||
subscribers: [uid],
|
subscribers: [uid],
|
||||||
@@ -1501,6 +1503,11 @@ describe('User', () => {
|
|||||||
meta.config.includeUnverifiedEmails = oldValue;
|
meta.config.includeUnverifiedEmails = oldValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return 0', async () => {
|
||||||
|
const sent = await User.digest.send({ subscribers: [] });
|
||||||
|
assert.strictEqual(sent, 0);
|
||||||
|
});
|
||||||
|
|
||||||
it('should not send digests', async () => {
|
it('should not send digests', async () => {
|
||||||
await User.digest.execute({ interval: 'month' });
|
await User.digest.execute({ interval: 'month' });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user