New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

redux-tdd

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-tdd - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

8

dist/redux-tdd.js

@@ -79,2 +79,10 @@ "use strict";

var _old = ReduxTdd;
ReduxTdd = function ReduxTdd() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return new (Function.prototype.bind.apply(_old, [null].concat(args)))();
};
exports.default = ReduxTdd;

2

package.json
{
"name": "redux-tdd",
"version": "0.0.4",
"version": "0.0.5",
"description": "Dot-chaining syntax for doing TDD with redux by composing unit tests as if they were integration tests",

@@ -5,0 +5,0 @@ "main": "dist/redux-tdd.js",

@@ -5,2 +5,22 @@ ## Redux TDD

### Install
`npm install --save redux-tdd`
```js
import ReduxTdd from 'redux-tdd';
ReduxTdd({ count: 0 }, state =>
<Counter
onClick={incrementAction}
counter={state.count} />
)
.simulate(wrapper => wrapper.find(button).simulate('click'))
.action(incrementAction).toMatchAction({ type: 'INCREMENT' })
.reducer(reducer).toMatchState({ count: 1 })
.view().contains(<span>1</span>);
```
### About
Redux allows us to test each individual part of the unidirectional flow independently without having to worry much about doing integration tests. As visualized below, you can test the action, the reducer and the view, individually:

@@ -56,3 +76,3 @@

```js
reduxTdd({ count: 0 }, state => <Counter onClick={incrementAction} counter={state.count} />)
ReduxTdd({ count: 0 }, state => <Counter onClick={incrementAction} counter={state.count} />)
.simulate(wrapper => wrapper.find(button).simulate('click'))

@@ -71,3 +91,3 @@ .action(incrementAction).toReturn({ type: 'INCREMENT' }) // checks that `incrementAction` is called and returns this object

```js
reduxTdd({ count: 9 }, state => <ResetCounter at={10} onClick={incrementAction} counter={state.count} />)
ReduxTdd({ count: 9 }, state => <ResetCounter at={10} onClick={incrementAction} counter={state.count} />)
.simulate(wrapper => wrapper.find(button).simulate('click'))

@@ -88,3 +108,3 @@ .action(incrementAction)

```js
reduxTdd({ count: 9 }, state => <Counter onClick={incrementAsyncAction} counter={state.count} />)
ReduxTdd({ count: 9 }, state => <Counter onClick={incrementAsyncAction} counter={state.count} />)
.simulate(wrapper => wrapper.find(button).simulate('click'))

@@ -106,3 +126,3 @@ .action(incrementAsyncAction).toReturn({ type: ‘INCREMENT_ASYNC’ })

```js
reduxTdd({ count: 9 }, state => <Counter onClick={incrementAsyncAction} counter={state.count} />)
ReduxTdd({ count: 9 }, state => <Counter onClick={incrementAsyncAction} counter={state.count} />)
.simulate(wrapper => wrapper.find(button).simulate('click'))

@@ -109,0 +129,0 @@ // incrementAsyncThunk() dispatches 'INCREMENT_ASYNC' and then we force (in a promise) 'INCREMENT_SUCCESS'

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