cache-spec.js 570 B

1234567891011121314151617181920
  1. const cache = require("../src/cache.js");
  2. describe("pulsar-updater cache", () => {
  3. it("returns key for path", () => {
  4. let key = cache.cacheKeyForPath("test");
  5. expect(key).toBe("pulsar-updater:test");
  6. });
  7. it("returns expired properly according to date", () => {
  8. let expiry = cache.isItemExpired({ createdOn: Date.now() });
  9. expect(expiry).toBe(false);
  10. });
  11. it("returns not expired if offline", () => {
  12. spyOn(cache, "online").andReturn(true);
  13. let expiry = cache.isItemExpired({ createdOn: 0 });
  14. expect(expiry).toBe(false);
  15. })
  16. });