All Projects → akameco → reducer-tester

akameco / reducer-tester

Licence: MIT License
Utilities for testing redux reducers

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to reducer-tester

Snap Shot It
Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
Stars: ✭ 138 (+626.32%)
Mutual labels:  test, snapshot-testing, snapshot
Snap Shot
Jest-like snapshot feature for the rest of us, works magically by finding the right caller function
Stars: ✭ 170 (+794.74%)
Mutual labels:  jest, test, snapshot
Snapshot Diff
Diffing snapshot utility for Jest
Stars: ✭ 490 (+2478.95%)
Mutual labels:  jest, snapshot-testing, snapshot
Snapshooter
Snapshooter is a snapshot testing tool for .NET Core and .NET Framework
Stars: ✭ 118 (+521.05%)
Mutual labels:  test, snapshot-testing, snapshot
Typescript Snapshots Plugin
Snapshots language service support for Typescript
Stars: ✭ 122 (+542.11%)
Mutual labels:  jest, snapshot-testing, snapshot
walrus
🎉 Cli development framework.
Stars: ✭ 17 (-10.53%)
Mutual labels:  jest, test
Jest Expect Message
Add custom message to Jest expects 🃏🗯
Stars: ✭ 240 (+1163.16%)
Mutual labels:  jest, test
Vuex Mock Store
✅Simple and straightforward Vuex Store mock for vue-test-utils
Stars: ✭ 246 (+1194.74%)
Mutual labels:  jest, test
Odiff
The fastest pixel-by-pixel image visual difference tool in the world.
Stars: ✭ 1,173 (+6073.68%)
Mutual labels:  diff, snapshot
Javascript Testing Best Practices
📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (August 2021)
Stars: ✭ 13,976 (+73457.89%)
Mutual labels:  jest, test
Jest Image Snapshot
✨ Jest matcher for image comparisons. Most commonly used for visual regression testing.
Stars: ✭ 2,940 (+15373.68%)
Mutual labels:  jest, snapshot
dify
A fast pixel-by-pixel image comparison tool in Rust
Stars: ✭ 41 (+115.79%)
Mutual labels:  diff, snapshot
Jest Html Reporter
Jest test results processor for generating a summary in HTML
Stars: ✭ 161 (+747.37%)
Mutual labels:  jest, test
Jest Html Reporters
🌈 Reporter for jest test framework. 🌈
Stars: ✭ 245 (+1189.47%)
Mutual labels:  jest, test
React Native Testing Example
Example of unit testing a React Native & Redux app using Jest (and Snapshots!)
Stars: ✭ 159 (+736.84%)
Mutual labels:  jest, snapshot
Sirix
SirixDB is a temporal, evolutionary database system, which uses an accumulate only approach. It keeps the full history of each resource. Every commit stores a space-efficient snapshot through structural sharing. It is log-structured and never overwrites data. SirixDB uses a novel page-level versioning approach called sliding snapshot.
Stars: ✭ 638 (+3257.89%)
Mutual labels:  diff, snapshot
got
An enjoyable golang test framework.
Stars: ✭ 234 (+1131.58%)
Mutual labels:  diff, test
generator-react-jest-tests
A React Jest test generator. Generates snapshot tests for React components.
Stars: ✭ 34 (+78.95%)
Mutual labels:  test, snapshot-testing
xv
❌ ✔️ zero-config test runner for simple projects
Stars: ✭ 588 (+2994.74%)
Mutual labels:  jest, test
Gest
👨‍💻 A sensible GraphQL testing tool - test your GraphQL schema locally and in the cloud
Stars: ✭ 109 (+473.68%)
Mutual labels:  jest, test

reducer-tester

Build Status tested with jest styled with prettier All Contributors

reducer tester

See how-to-test-reducers

Install

$ yarn add --dev reducer-tester

Usage

// reducer.js
export const initialState = { count: 0, other: 'other' }

export default (state = initialState, action) => {
  switch (action.type) {
    case 'inc':
      return { ...state, count: state.count + 1 }
    case 'dec':
      return { ...state, count: state.count - 1 }
    default:
      return state
  }
}

// reducer.test.js
import reducerTester from 'reducer-tester'
import reducer, { initialState } from './reducer'

reducerTester({
  reducer,
  state: initialState,
  tests: [{ type: 'inc' }, { type: 'dec' }],
})

Snapshot

// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`handle initial state 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
`;

exports[`dec 1`] = `
"Snapshot Diff:
- Before
+ After

  Object {
-   "count": 0,
+   "count": -1,
    "other": "other",
  }"
`;

exports[`inc 1`] = `
"Snapshot Diff:
- Before
+ After

  Object {
-   "count": 0,
+   "count": 1,
    "other": "other",
  }
`;

Full example

import reducerTester from 'reducer-tester'
import reducer, { initialState } from './reducer'

reducerTester({
  reducer, // #required
  state: initialState, // #required
  tests: [{ type: 'inc' }, { type: 'dec' }], // #required
  initialTest: false, // # optional, default: true
  titlePrefix: 'handle ', // # optional, default: ''
})
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`handle dec 1`] = `
"Snapshot Diff:
- Before
+ After

  Object {
-   "count: 0,
+   count: -1,
  }
`;

exports[`handle inc 1`] = `
"Snapshot Diff:
- Before
+ After

  Object {
-   count: 0,
+   count: 1,
  }
`;

Tips

Atom Editor User

Install language-diff and file-types. And open config.json and edit as blow.

"*":
  "file-types":
    "\\.js\\.snap$": "source.diff"

Hooray! Very readable!

68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f31353331392f64666537363137312d323735322d646265302d613038652d6330633436646330396264662e706e67 (495×575)

Contributors

Thanks goes to these wonderful people (emoji key):

akameco
akameco

💻 📖 ⚠️ 🚇
Ahn Dohyung
Ahn Dohyung

📖
kinakobo
kinakobo

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT © akameco

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].