JSFiddle - React, Tailwind, and code Playground

by yashsoni

HTML

<script src="https://npmcdn.com/redux/dist/redux.js"></script>
<script src="https://wzrd.in/standalone/expect@latest"></script>

Babel + JSX

const counter = (state = 0, action) => {
 // ...
}

const counters = (...) => {

};

expect(
	counters(undefined, {})
).toEqual([]);

expect(
	counters([], { type: 'ADD_COUNTER' })
).toEqual([0]);

expect(
	counters([0], { type: 'ADD_COUNTER '})
).toEqual([0, 0]);

expect(
	counters([0, 0, 0], {
  	type: 'INCREMENT',
    index: 1
  })
).toEqual([0, 1, 0]);

expect(
	counter(0, { type: 'INCREMENT' })
).toEqual(1);

expect(
	counter(1, { type: 'INCREMENT' })
).toEqual(2);

expect(
	counter(2, { type: 'DECREMENT' })
).toEqual(1);

expect(
	counter(undefined, {})
).toEqual(0);

console.log('All tests pass');