Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

A mock for the browser cache that can be used in a node environment

License

Notifications You must be signed in to change notification settings

MechanicalRock/browser-cache-mock

Repository files navigation

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

About

A mock for the browser cache that can be used in a node environment

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •