mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
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);
|
||
|
});
|
||
|
});
|
||
|
});
|