2018-10-24 00:39:02 +08:00
|
|
|
'use strict';
|
|
|
|
|
2019-10-07 17:29:07 +08:00
|
|
|
require('../../../support/test-helper');
|
2015-09-17 19:58:22 +08:00
|
|
|
|
2015-01-26 22:02:28 +08:00
|
|
|
var assert = require('assert');
|
|
|
|
var _ = require('underscore');
|
2019-10-07 17:29:07 +08:00
|
|
|
var NamedMapsCacheEntry = require('../../../../lib/cache/model/named-maps-entry');
|
2015-01-26 22:02:28 +08:00
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
describe('cache named maps entry', function () {
|
|
|
|
var namedMapOwner = 'foo';
|
|
|
|
var namedMapName = 'wadus_name';
|
|
|
|
var namedMapsCacheEntry = new NamedMapsCacheEntry(namedMapOwner, namedMapName);
|
|
|
|
var entryKey = namedMapsCacheEntry.key();
|
2015-01-26 22:02:28 +08:00
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
it('key is a string', function () {
|
2015-01-26 22:02:28 +08:00
|
|
|
assert.ok(_.isString(entryKey));
|
|
|
|
});
|
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
it('key is 8 chars length', function () {
|
2019-10-22 01:41:03 +08:00
|
|
|
assert.strictEqual(entryKey.length, 8);
|
2015-01-26 22:02:28 +08:00
|
|
|
var entryKeyParts = entryKey.split(':');
|
2019-10-22 01:41:03 +08:00
|
|
|
assert.strictEqual(entryKeyParts.length, 2);
|
|
|
|
assert.strictEqual(entryKeyParts[0], 'n');
|
2015-01-26 22:02:28 +08:00
|
|
|
});
|
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
it('key is name spaced for named maps', function () {
|
2015-01-26 22:02:28 +08:00
|
|
|
var entryKeyParts = entryKey.split(':');
|
2019-10-22 01:41:03 +08:00
|
|
|
assert.strictEqual(entryKeyParts.length, 2);
|
|
|
|
assert.strictEqual(entryKeyParts[0], 'n');
|
2015-01-26 22:02:28 +08:00
|
|
|
});
|
|
|
|
});
|