Ghost/core/test/unit/settings/cache_spec.js
Katharina Irrgang a61e6e7cc2 🐛 fix settings cache (#8506)
closes #8505

- cache.get(..) auto converted "1" to integer
2017-06-04 17:52:22 +07:00

22 lines
755 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('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);
});
});