Skip to content

Instantly share code, notes, and snippets.

View evertbouw's full-sized avatar

Evert Bouw evertbouw

  • Amsterdam, Netherlands
View GitHub Profile
@evertbouw
evertbouw / cra-polyfill.md
Last active February 7, 2020 11:40
How to add the create-react-app polyfill for IE11 only
  • Remove import 'react-app-polyfill/ie11' from your index.js and put it in a new file src/polyfill.js
  • install webpack-cli yarn add -D webpack-cli or npm i -D webpack-cli
  • add npm script "polyfill": "webpack -p ./src/polyfill.js -o ./build/ie11.js"
  • add to build script "build": "react-scripts build && npm run polyfill",
  • add to the of public/index.html
@evertbouw
evertbouw / epicMarbleTest.ts
Last active May 17, 2019 13:59
Writing tests for epics with state$ and using marble diagrams. More information on marble testing can be found at https://github.com/ReactiveX/rxjs/blob/master/doc/marble-testing.md
import { Action } from "redux";
import { ActionsObservable, Epic, StateObservable } from "redux-observable";
import { TestScheduler } from "rxjs/testing";
const assertDeepEquals = (actual: any, expected: any) => {
expect(actual).toEqual(expected);
};
export const marbleTest = <T extends Action, O extends T = T, S = void, D = any>({
epic,
@evertbouw
evertbouw / epicTestFunction.ts
Last active January 7, 2020 20:43
Writing tests for epics with state$
import { Action } from "redux";
import { ActionsObservable, Epic, StateObservable } from "redux-observable";
import { Subject } from "rxjs";
import { toArray } from "rxjs/operators";
const stateInput$ = new Subject();
const state$ = new StateObservable<any>(stateInput$, undefined);
interface IEpicTest<A extends Action, S, D> {
(params: {