browser-cache-mock
TypeScript icon, indicating that this package has built-in type declarations

0.1.7 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i browser-cache-mock

Weekly Downloads

2,470

Version

0.1.7

License

MIT

Unpacked Size

13.9 kB

Total Files

7

Last publish

Collaborators

  • rick_foxcroft