Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-action-logging

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-action-logging

Redux testing utility middleware to log actions received by a store without mocking that store.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
347
decreased by-38.37%
Maintainers
1
Weekly downloads
 
Created
Source

redux-action-logging

Redux testing utility middlware to log actions received by a store without mocking that store.

Installation

npm install redux-action-logging

Add redux-action-logging to your middleware chain. You likely only want to do this in your test suite and not in production

import { createStore, applyMiddleware } from "redux"
import reducer from "./reducer"

import {
  storeActionsMiddleware,
  storeActions
} from "redux-action-logging"

const middlewares = [storeActionsMiddleware]
store = applyMiddleware(...middlewares)(createStore)(reducer)

Usage

// Given these actions sent to your store:
store.dispatch({ type: FOO })
store.dispatch({ type: BAR })
store.dispatch({ type: BAZ, value: 10 })
store.dispatch((dispatch, getState) => dispatch({type: QUX }))

// These return true:
storeActions.has(FOO)
storeActions.has(FOO, BAR)
storeActions.has(BAZ, BAR)
storeActions.has({ type: BAZ, value: 10 })
storeActions.has(QUX)
storeActions.has(
  BAR,
  { type: BAZ, value: 10}
)

// These return false:
storeActions.has(XYZZY)
storeActions.has(FOO, XYZZY)
storeActions.has({ type: BAZ, value: 5 })
storeActions.has(
  BAR,
  { type: BAZ, value: 5}
)


storeActions.actions() // returns array of all actions received by your store
storeActions.clear()   // clears array

License

MIT

Keywords

FAQs

Package last updated on 26 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc