2015-09-17 19:58:22 +08:00
|
|
|
require('../../../../support/test_helper');
|
|
|
|
|
2015-01-26 22:02:28 +08:00
|
|
|
var assert = require('assert');
|
|
|
|
var _ = require('underscore');
|
|
|
|
var NamedMapsCacheEntry = require('../../../../../lib/cartodb/cache/model/named_maps_entry');
|
|
|
|
|
2015-09-25 19:31:51 +08:00
|
|
|
describe('cache named_maps_entry', function() {
|
2015-01-26 22:02:28 +08:00
|
|
|
|
|
|
|
var namedMapOwner = 'foo',
|
|
|
|
namedMapName = 'wadus_name',
|
|
|
|
namedMapsCacheEntry = new NamedMapsCacheEntry(namedMapOwner, namedMapName),
|
|
|
|
entryKey = namedMapsCacheEntry.key();
|
|
|
|
|
2015-09-25 19:31:51 +08:00
|
|
|
it('key is a string', function() {
|
2015-01-26 22:02:28 +08:00
|
|
|
assert.ok(_.isString(entryKey));
|
|
|
|
});
|
|
|
|
|
2015-09-25 19:31:51 +08:00
|
|
|
it('key is 8 chars length', function() {
|
2015-01-26 22:02:28 +08:00
|
|
|
assert.equal(entryKey.length, 8);
|
|
|
|
var entryKeyParts = entryKey.split(':');
|
|
|
|
assert.equal(entryKeyParts.length, 2);
|
|
|
|
assert.equal(entryKeyParts[0], 'n');
|
|
|
|
});
|
|
|
|
|
2015-09-25 19:31:51 +08:00
|
|
|
it('key is name spaced for named maps', function() {
|
2015-01-26 22:02:28 +08:00
|
|
|
var entryKeyParts = entryKey.split(':');
|
|
|
|
assert.equal(entryKeyParts.length, 2);
|
|
|
|
assert.equal(entryKeyParts[0], 'n');
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|