Files
coopgo/node_modules/apollo-cache-inmemory/lib/__tests__/objectCache.js
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

33 lines
1.2 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var objectCache_1 = require("../objectCache");
describe('ObjectCache', function () {
it('should create an empty cache', function () {
var cache = new objectCache_1.ObjectCache();
expect(cache.toObject()).toEqual({});
});
it('should create a cache based on an Object', function () {
var contents = { a: {} };
var cache = new objectCache_1.ObjectCache(contents);
expect(cache.toObject()).toEqual(contents);
});
it("should .get() an object from the store by dataId", function () {
var contents = { a: {} };
var cache = new objectCache_1.ObjectCache(contents);
expect(cache.get('a')).toBe(contents.a);
});
it("should .set() an object from the store by dataId", function () {
var obj = {};
var cache = new objectCache_1.ObjectCache();
cache.set('a', obj);
expect(cache.get('a')).toBe(obj);
});
it("should .clear() the store", function () {
var obj = {};
var cache = new objectCache_1.ObjectCache();
cache.set('a', obj);
cache.clear();
expect(cache.get('a')).toBeUndefined();
});
});
//# sourceMappingURL=objectCache.js.map