Revert "Feature: Adds connectWithCleanup HOC (#19392)" (#19628)

This reverts commit 989f98efda.
This commit is contained in:
Hugo Häggmark
2019-10-04 05:24:47 -07:00
committed by GitHub
parent 989f98efda
commit 3e603cd88a
8 changed files with 48 additions and 250 deletions

View File

@@ -3,7 +3,7 @@ import { Reducer } from 'redux';
import { ActionOf } from 'app/core/redux/actionCreatorFactory';
export interface Given<State> {
givenReducer: (reducer: Reducer<State, ActionOf<any>>, state: State, disableDeepFreeze?: boolean) => When<State>;
givenReducer: (reducer: Reducer<State, ActionOf<any>>, state: State) => When<State>;
}
export interface When<State> {
@@ -12,7 +12,6 @@ export interface When<State> {
export interface Then<State> {
thenStateShouldEqual: (state: State) => When<State>;
thenStatePredicateShouldEqual: (predicate: (resultingState: State) => boolean) => When<State>;
}
interface ObjectType extends Object {
@@ -54,16 +53,10 @@ export const reducerTester = <State>(): Given<State> => {
let resultingState: State;
let initialState: State;
const givenReducer = (
reducer: Reducer<State, ActionOf<any>>,
state: State,
disableDeepFreeze = false
): When<State> => {
const givenReducer = (reducer: Reducer<State, ActionOf<any>>, state: State): When<State> => {
reducerUnderTest = reducer;
initialState = { ...state };
if (!disableDeepFreeze) {
initialState = deepFreeze(initialState);
}
initialState = deepFreeze(initialState);
return instance;
};
@@ -80,18 +73,7 @@ export const reducerTester = <State>(): Given<State> => {
return instance;
};
const thenStatePredicateShouldEqual = (predicate: (resultingState: State) => boolean): When<State> => {
expect(predicate(resultingState)).toBe(true);
return instance;
};
const instance: ReducerTester<State> = {
thenStateShouldEqual,
thenStatePredicateShouldEqual,
givenReducer,
whenActionIsDispatched,
};
const instance: ReducerTester<State> = { thenStateShouldEqual, givenReducer, whenActionIsDispatched };
return instance;
};