Sha256: ea4b356e6ac09f27cd0cb4de6f16a03eafa45b06a23db2adceda04f739236dbe

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

describe('Factory: TableCahce', function () {
    var $cacheFactory, cache, TableCache, table;

    beforeEach(module('Bastion.components'));

    beforeEach(module(function ($provide) {
        cache = {
            get: function () {
                return table;
            },
            put: function () {}
        };

        $cacheFactory = function () {
            return cache;
        };

        $provide.value('$cacheFactory', $cacheFactory);
    }));

    beforeEach(inject(function (_TableCache_) {
        TableCache = _TableCache_;
        table = {id: 1};
    }));

    it("allows adding a table to the cache", function () {
        spyOn(cache, 'put').and.callThrough();
        TableCache.setTable("table", table);
        expect(cache.put).toHaveBeenCalledWith("table", table);
    });

    it("allows getting a table from the cache", function () {
        var result;
        spyOn(cache, 'get').and.callThrough();
        result = TableCache.getTable("table");
        expect(cache.get).toHaveBeenCalledWith("table");
        expect(result).toBe(table);
    });
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bastion-4.1.0 test/components/table-cache.service.test.js
bastion-4.0.0 test/components/table-cache.service.test.js