mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 16:01:40 +03:00
d8187123af
fixes https://github.com/TryGhost/Team/issues/2332 Saves events in the database and collects error information. Do note that we can emit the same events multiple times, and as a result out of order. That means we should correctly handle that a delivered event might be fired after a permanent failure. So a delivered event is ignored if the email is already marked as failed. Also delivered_at is reset to null when we receive a permanent failure.
23 lines
782 B
JavaScript
23 lines
782 B
JavaScript
const assert = require('assert');
|
|
const ObjectID = require('bson-objectid').default;
|
|
const EmailBouncedEvent = require('../../lib/EmailBouncedEvent');
|
|
|
|
describe('EmailBouncedEvent', function () {
|
|
it('exports a static create method to create instances', function () {
|
|
const event = EmailBouncedEvent.create({
|
|
id: 'id',
|
|
email: 'test@test.test',
|
|
memberId: new ObjectID().toHexString(),
|
|
emailId: new ObjectID().toHexString(),
|
|
emailRecipientId: new ObjectID().toHexString(),
|
|
timestamp: new Date(),
|
|
error: {
|
|
message: 'test',
|
|
code: 1,
|
|
enhancedCode: '1.1'
|
|
}
|
|
});
|
|
assert(event instanceof EmailBouncedEvent);
|
|
});
|
|
});
|