UNPKG

1.27 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var objectCache_1 = require("../objectCache");
4describe('ObjectCache', function () {
5 it('should create an empty cache', function () {
6 var cache = new objectCache_1.ObjectCache();
7 expect(cache.toObject()).toEqual({});
8 });
9 it('should create a cache based on an Object', function () {
10 var contents = { a: {} };
11 var cache = new objectCache_1.ObjectCache(contents);
12 expect(cache.toObject()).toEqual(contents);
13 });
14 it("should .get() an object from the store by dataId", function () {
15 var contents = { a: {} };
16 var cache = new objectCache_1.ObjectCache(contents);
17 expect(cache.get('a')).toBe(contents.a);
18 });
19 it("should .set() an object from the store by dataId", function () {
20 var obj = {};
21 var cache = new objectCache_1.ObjectCache();
22 cache.set('a', obj);
23 expect(cache.get('a')).toBe(obj);
24 });
25 it("should .clear() the store", function () {
26 var obj = {};
27 var cache = new objectCache_1.ObjectCache();
28 cache.set('a', obj);
29 cache.clear();
30 expect(cache.get('a')).toBeUndefined();
31 });
32});
33//# sourceMappingURL=objectCache.js.map
\No newline at end of file