0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/test/unit/services/posts/posts-service.test.js
Naz e3b56dd99f 🐛 Fixed immediately sent email when scheduling email-only post
closes https://linear.app/tryghost/issue/CORE-78/email-only-scheduling-should-work-the-same-way-as-regular-posts

- The email was going out at the moment of scheduling an email-only post instead of respecting the scheduled time.
2021-10-05 16:42:29 +02:00

25 lines
1.2 KiB
JavaScript

const should = require('should');
const {PostsService} = require('../../../../core/server/services/posts/posts-service');
describe('PostsService', function () {
describe('shouldSendEmail', function () {
it('calculates if an email should be sent', async function () {
const postsService = new PostsService({});
postsService.shouldSendEmail('published', 'draft').should.be.true();
postsService.shouldSendEmail('published', 'scheduled').should.be.true();
postsService.shouldSendEmail('sent', 'draft').should.be.true();
postsService.shouldSendEmail('sent', 'scheduled').should.be.true();
postsService.shouldSendEmail('published', 'published').should.be.false();
postsService.shouldSendEmail('published', 'sent').should.be.false();
postsService.shouldSendEmail('published', 'published').should.be.false();
postsService.shouldSendEmail('published', 'sent').should.be.false();
postsService.shouldSendEmail('sent', 'published').should.be.false();
postsService.shouldSendEmail('sent', 'sent').should.be.false();
postsService.shouldSendEmail().should.be.false();
});
});
});