Sha256: 137c838a630205472e092d83127cc91daa7198029d2031b839885cd37c9deeb0

Contents?: true

Size: 1.32 KB

Versions: 43

Compression:

Stored size: 1.32 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 () {},
            remove: 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 removing a table from the cache", function () {
        spyOn(cache, 'remove').and.callThrough();
        TableCache.removeTable("table");
        expect(cache.remove).toHaveBeenCalledWith("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

43 entries across 43 versions & 1 rubygems

Version Path
bastion-6.1.23 test/components/table-cache.service.test.js
bastion-6.1.22 test/components/table-cache.service.test.js
bastion-6.1.21 test/components/table-cache.service.test.js
bastion-6.1.20 test/components/table-cache.service.test.js
bastion-6.1.19 test/components/table-cache.service.test.js
bastion-6.1.18 test/components/table-cache.service.test.js
bastion-6.1.17 test/components/table-cache.service.test.js
bastion-6.1.16 test/components/table-cache.service.test.js
bastion-6.1.15 test/components/table-cache.service.test.js
bastion-6.1.14 test/components/table-cache.service.test.js
bastion-6.1.13 test/components/table-cache.service.test.js
bastion-6.1.12 test/components/table-cache.service.test.js
bastion-6.1.11 test/components/table-cache.service.test.js
bastion-6.1.10 test/components/table-cache.service.test.js
bastion-6.1.9 test/components/table-cache.service.test.js
bastion-6.1.8 test/components/table-cache.service.test.js
bastion-6.1.7 test/components/table-cache.service.test.js
bastion-6.1.6 test/components/table-cache.service.test.js
bastion-6.1.5 test/components/table-cache.service.test.js
bastion-6.1.4 test/components/table-cache.service.test.js