JSFiddle - React, Tailwind, and code Playground
by Angelos Chaidas
HTML
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
Babel + JSX
// https://egghead.io/lessons/javascript-redux-avoiding-array-mutations-with-concat-slice-and-spread
const addCounter = (list) => {
list.push(0);
return list;
};
const testAddCounter = () => {
const listBefore = [];
const listAfter = [0];
deepFreeze(listBefore);
expect(addCounter(listBefore)).toEqual(listAfter);
}
testAddCounter();
console.log('All tests passed');