Ghost/core/test/unit/api/index_spec.js
kirrg001 0ae0a0b490 🎨 change how we get and set config
refs #6982
- a replace for all config usages
- always use config.get or config.set
- this a pure replacement, no logic has changed

[ci skip]
2016-09-20 15:59:34 +01:00

33 lines
1.1 KiB
JavaScript

var should = require('should'),
rewire = require('rewire'),
config = rewire('../../../server/config'),
api = rewire(config.get('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);
});
});
});