This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install tslint-immutable --save-dev | |
// tslint.json | |
{ | |
"extends": ["tslint-immutable"], | |
"rules": { | |
// Recommended built-in rules | |
"no-var-keyword": true, | |
"no-parameter-reassignment": true, | |
"typedef": [true, "call-signature"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from https://www.youtube.com/watch?v=MSpDAuDPqNw | |
import OtherPage from "./OtherPage"; | |
import {fireEvent, render, screen, waitFor} from "@testing-library/react"; | |
import {DataMuseApiContext} from "./SomeLayout"; | |
describe('the page', () => { | |
it('should do stuff', async () => { | |
const logSpy = jest.spyOn(console, 'log') // never do that :p | |
render(<DataMuseApiContext.Provider value={{ | |
async getWordsSoundingLike(word: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// idea from https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367 | |
import './App.css'; | |
import React, {useState} from "react"; | |
interface ActionType { | |
type: string; | |
} | |
function CounterReducer(state = {value: 0}, action: ActionType = {type: ""}) { | |
switch (action.type) { |