0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/test/unit/settings/cache_spec.js
Katharina Irrgang 34054a32c0 🐛 Theme name is point number (#9184)
closes #9182

- e.g. "1.4"
- extend settings cache to ensure we return strings for numbers and floating point numbers
2017-10-26 13:54:18 +02:00

26 lines
936 B
JavaScript

var rewire = require('rewire'),
should = require('should'),
cache = rewire('../../../server/settings/cache');
should.equal(true, true);
describe('UNIT: settings cache', function () {
it('does not auto convert string into number', function () {
cache.set('key1', {value: '1'});
(typeof cache.get('key1')).should.eql('string');
});
it('does not auto convert string into number: float', function () {
cache.set('key1', {value: '1.4'});
(typeof cache.get('key1')).should.eql('string');
});
it('stringified JSON get\'s parsed', function () {
cache.set('key2', {value: '{"a":"1","b":"hallo","c":{"d":[]},"e":2}'});
(typeof cache.get('key2')).should.eql('object');
cache.get('key2').a.should.eql('1');
cache.get('key2').b.should.eql('hallo');
cache.get('key2').c.should.eql({d: []});
cache.get('key2').e.should.eql(2);
});
});