mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
refs #9866 - preparation for v2 - moved api/ to api/v0.1 - do export v0.1 straight from the api folder, we don't want to touch this right now - that means currently if you require the api folder, we return v0.1 by default - there were some direct requires of api files in the test env - some of them use rewire - for now, we just correct the require path to require api/v0.1/ - we touch the test env next week **Docs about V2 design are coming soon!**
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
var should = require('should'),
|
|
rewire = require('rewire'),
|
|
config = rewire('../../../server/config'),
|
|
api = rewire(config.get('paths').corePath + '/server/api/v0.1');
|
|
|
|
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);
|
|
});
|
|
});
|
|
});
|