0.1.7 • Published 5 years ago

browser-cache-mock v0.1.7

Weekly downloads
1,057
License
MIT
Repository
github
Last release
5 years ago

Browser Cache Mock

CircleCI npm version Coverage Status

A mock for the browser cache API that can be used in a node environment. Creating a new instance creates an in-memory cache that can enable you to test your browser caching strategies effectively.

  • This module is Typescript ready.

Installation

npm i -D browser-cache-mock

Usage

Add the following to your test code:

import CacheMock from 'browser-cache-mock';

const cacheMock = new CacheMock();

window = {
    ...window,
    caches: {
        ...window.caches,
        open: async () => cacheMock,
        ...cacheMock
    }
};

License

MIT

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago