mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
1421c92ba5
refs #6413 - PUT endpoint to publish a post/page for the scheduler - fn endpoint to get all scheduled posts (with from/to query params) for the scheduler - hardcoded permission handling for scheduler client - fix event bug: unscheduled - basic structure for scheduling - post scheduling basics - offer easy option to change adapter - integrate the default scheduler adapter - update scheduled posts when blog TZ changes - safety check before scheduler can publish a post (not allowed to publish in the future or past) - add force flag to allow publishing in the past - invalidate cache header for /schedules/posts/:id
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
/*globals describe, it */
|
|
var should = require('should'),
|
|
rewire = require('rewire'),
|
|
config = rewire('../../../server/config'),
|
|
api = rewire(config.paths.corePath + '/server/api');
|
|
|
|
describe('API: index', function () {
|
|
describe('fn: cacheInvalidationHeader', function () {
|
|
it('/schedules/posts should invalidate cache', function () {
|
|
var cacheInvalidationHeader = api.__get__('cacheInvalidationHeader'),
|
|
result = cacheInvalidationHeader({
|
|
_parsedUrl: {
|
|
pathname: '/schedules/posts/1'
|
|
},
|
|
method: 'PUT'
|
|
}, {});
|
|
|
|
result.should.eql('/*');
|
|
});
|
|
|
|
it('/schedules/something should NOT invalidate cache', function () {
|
|
var cacheInvalidationHeader = api.__get__('cacheInvalidationHeader'),
|
|
result = cacheInvalidationHeader({
|
|
_parsedUrl: {
|
|
pathname: '/schedules/something'
|
|
},
|
|
method: 'PUT'
|
|
}, {});
|
|
|
|
should.not.exist(result);
|
|
});
|
|
});
|
|
});
|