UNPKG

barba.js

Version:

Barba.js it's a small, flexible and dependency free library that helps you creating fluid and smooth transition between your website's pages.

25 lines (19 loc) 643 B
describe('Cache', function() { var cache = Barba.Pjax.Cache; it('should exists', function() { expect(cache).toBeTruthy(); expect(Object.keys(cache.data).length).toBe(0); }); it('should be able to cache information', function() { cache.set('test', 'hello'); expect(Object.keys(cache.data).length).toBe(1); }); it('should be able to get saved information', function() { expect(cache.get('test')).toBe('hello'); expect(cache.get('undefinedkey')).toBe(undefined); }); it('should be able to reset the cache', function() { cache.reset(); expect(Object.keys(cache.data).length).toBe(0); }); });