mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 19:02:29 +03:00
9e96b04542
- this is a small part of a bit of cleanup of our test files - the goal is to make the existing tests clearer with a view to making it easier to write more tests - this makes the test structure follow the codebase structure more closely - eventually we will colocate the tests as we break the codebase down further
26 lines
1.2 KiB
JavaScript
26 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();
|
|
});
|
|
});
|
|
});
|